DOCUMENT:Q94408 06-MAY-2001 [masm] TITLE :FIX: A2138 Error--Structure Member Span-Dependent Equate PRODUCT :Microsoft Macro Assembler PROD/VER::6.0,6.0a,6.0b,6.1,6.1a OPER/SYS: KEYWORDS: ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Macro Assembler (MASM), versions 6.0, 6.0a, 6.0b, 6.1, 6.1a ------------------------------------------------------------------------------- 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 : Technology : kbMASMsearch kbAudDeveloper kbMASM600 kbMASM610 kbMASM610a kbMASM600a kbMASM600b Version : :6.0,6.0a,6.0b,6.1,6.1a 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. Copyright Microsoft Corporation 2001.