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

Last reviewed: September 16, 1997
Article ID: Q94912
6.00 6.00a 6.00b | 6.00 6.00a 6.00b
MS-DOS           | OS/2
kbtool kbfixlist kbbuglist

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 reference words: 6.00 6.00a 6.00b buglist6.00 buglist6.00a
buglist6.00b fixlist6.10
KBCategory: kbtool kbfixlist kbbuglist
KBSubCategory: MLIss
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.