Microsoft KB Archive/59374

= FIX: Incorrect Code With TYPE and SI Index Register =

Article ID: 59374

Article Last Modified on 10/17/2003

-

APPLIES TO


 * Microsoft Macro Assembler 5.1 Standard Edition
 * Microsoft Macro Assembler 5.1a

-



This article was previously published under Q59374



SYMPTOMS
An incorrect opcode is generated by the Microsoft Macro Assembler (MASM) versions 5.1 and 5.1a when using the TYPE operator and the SI register are used in an indirect memory operand.



STATUS
Microsoft has confirmed this to be a problem in MASM versions 5.1 and 5.1a. This problem was corrected in MASM version 6.0.



MORE INFORMATION
The type operator returns a number that represents the type of an expression. This is normally the size of the variable. For example, a variable declared as dw will cause TYPE to return the number 2.

Each of the CMP instructions in the sample below should produce the exact same encoding. Verify with a listing file that an incorrect encoding is produced. The opcode portion of the instruction is 3b84 in the correct examples and 3b06 in the incorrect examples.

Sample Code
; Assemble options needed: none

.MODEL small .STACK 4096                      ; Allocate 4K stack space .DATA var1 dw 0

.CODE main proc MOV ax, @data              ; Set up the DS register MOV ds, ax                 ;

CMP ax,var1[si]+type var1  ; Incorrect code generated CMP ax,var1[si]+(type var1) ; Incorrect code generated CMP ax,var1[si]+[type var1] ; Incorrect code generated CMP ax,type var1+var1[si]  ; correct code generated CMP ax,var1[si+type var1]  ; correct code generated CMP ax,var1[si]+2          ; correct code generated CMP ax,var1[si+2]          ; correct code generated

main ENDP END main

Additional query words: 5.10 5.10a buglist5.10 buglist5.10a fixlist6.00

Keywords: kbfix KB59374

-

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

© Microsoft Corporation. All rights reserved.