Microsoft KB Archive/94408

= FIX: A2138 Error--Structure Member Span-Dependent Equate =

Article ID: 94408

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
 * Microsoft Macro Assembler 6.1 Standard Edition
 * Microsoft Macro Assembler 6.1a

-



This article was previously published under Q94408



SYMPTOMS
The process of assembling an application fails and the assembler generates an A2138 error message.



CAUSE
A structure member is initialized with an equate value that is computed as the difference between the addresses of two labels in the code (a span-dependent value).



RESOLUTION
To work around this problem, code an expression that evaluates to the difference between the addresses of the two labels. Initialize the structure using the expression.



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



MORE INFORMATION
In the code below, the structure member Member2 is initialized with the TableSize equate. The value of TableSize is generated by subtracting the value of label Table1 from value of label Table2. Assembling the following code causes the A2138 error.

Sample Code
; Assemble options needed: /Fl

data SEGMENT para public 'DATA'

Table1 LABEL WORD DW 0, 1 Table2 LABEL WORD

TableSize EQU Table2-Table1

InStruc STRUC Member1 DW Table2-Table1   ; This works correctly Member2 DW TableSize       ; This triggers the error InStruc ENDS

Inside InStruc <>              ; The error is generated here

OutsideOK DW TableSize         ; Using the equate outside ; the structure works data ENDS

_text SEGMENT para public 'CODE' start: mov ax, 4C00h int 21h _text ENDS END start

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

Keywords: kbfix KB94408

-

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

© Microsoft Corporation. All rights reserved.