Microsoft KB Archive/94912

= FIX: A2138, A2036 or Hang, Init Nested Structure Array =

Article ID: 94912

Article Last Modified on 10/16/2003

-

APPLIES TO


 * Microsoft Macro Assembler 6.0 Standard Edition
 * Microsoft Macro Assembler 6.0a
 * Microsoft Macro Assembler 6.0b

-



This article was previously published under Q94912



SYMPTOMS
An attempt to assemble code that initializes an array of nested structures fails and the computer hangs and stops responding or the assembler produces the following messages:

error A2138: invalid data initializer

error A2036: too many initial values for structure



RESOLUTION
To work around this problem, perform one of the following two steps:
 * Remove the initialization from the structure declaration -or-


 * Remove the DUP operator and declare multiple nested structure fields



STATUS
Microsoft has confirmed this to be a problem in MASM versions 6.0, 6.0a, and 6.0b for MS-DOS and OS/2. This problem was corrected in MASM version 6.1 for MS-DOS.



MORE INFORMATION
In code developed for Microsoft Macro Assembler (MASM) version 6.0 or later, an application can create nested structures or use the DUP operator to create arrays of structures. An application can initialize a nested structure or an array of structures. However, an attempt to initialize a structure that contains an array of nested structures fails with the errors listed above.

MASM version 6.1 generates the following error message when an application attempts to initialize an array of nested structures:

error A2177: nested structure improperly initialized

The following code example demonstrates this error.

Sample Code
; Assemble options needed: none

.MODEL small, c

inner_struct STRUCT w1 DW ? inner_struct ENDS

outer_struct STRUCT s1 inner_struct 2 DUP ({}) outer_struct ENDS

.DATA tst1 outer_struct   ; This line generates an error message
 * tst2 outer_struct –         ; This line is allowed

END

Additional query words: 6.00 6.00a 6.00b buglist6.00 buglist6.00a buglist6.00b fixlist6.10

Keywords: kbfix KB94912

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.