FIX: Subtracting Two Externs Gives Incorrect Results (75177)
The information in this article applies to:
- Microsoft Macro Assembler (MASM) 6.0
This article was previously published under Q75177 SYMPTOMS
Subtracting two external variables in the Microsoft Macro Assembler (MASM)
version 6.0 results in an incorrect value, and the assembler does not
generate any errors. It should produce an error similar to the one received
in MASM 5.1, such as:
A2032: Illegal Use of extern
CAUSE
When subtracting two local variables, the assembler will correctly
calculate the difference in their offsets. However, with external
variables, it does not know the offset at assemble time, so it cannot
correctly determine their difference.
RESOLUTION
The difference in offsets for external variables can be calculated by
moving the values into registers or temporary variables and then performing
the calculation. The sample code below illustrates this problem.
STATUS
Microsoft has confirmed this to be a problem in MASM version 6.0. This
problem was corrected in MASM version 6.0a.
Modification Type: | Major | Last Reviewed: | 10/20/2003 |
---|
Keywords: | kbfix KB75177 |
---|
|