FIX: Incorrect Code With TYPE and SI Index RegisterLast reviewed: September 11, 1997Article ID: Q59374 |
5.10 5.10a | 5.10 5.10a
MS-DOS | OS/2kbtool kbfixlist kbbuglist The information in this article applies to:
SYMPTOMSAn 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.
STATUSMicrosoft 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 INFORMATIONThe 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 generatedmain ENDP END main
|
Additional reference words: 5.10 5.10a buglist5.10 buglist5.10a fixlist6.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |