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

ID: Q94912


The information in this article applies to:
  • Microsoft Macro Assembler for MS-DOS and OS/2, versions 6.0, 6.0a, 6.0b


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 {{{1},{2}}}   ; 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 :
Version : MS-DOS:6.0,6.0a,6.0b
Platform : MS-DOS
Issue type :


Last Reviewed: January 6, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.