MSM9112008: Nested NOT Operators Yield Incorrect Value

ID Number: Q79286

6.00 6.00a | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a

Summary:

PROBLEM ID: MSM9112008

SYMPTOMS

If the NOT operator is used more than once in an expression in the

Microsoft Macro Assembler (MASM) versions 6.0 and 6.0a, an incorrect

value may be generated. For example

mov ax, not(not 0Fh)

incorrectly generates:

mov ax, FFF1h

RESOLUTION

To work around this, avoid using consecutive NOT operators. Using

two NOT operators is equivalent to using none.

STATUS

Microsoft has confirmed this to be a problem in MASM versions 6.0

and 6.0a. We are researching this problem and will post new

information here as it becomes available.

More Information:

Since the NOT operator should perform a bitwise or logical NOT

operation, two consecutive NOTs should produce the original number.

The sample code below demonstrates the problem.

Sample Code

-----------

; Assemble options needed: None

.MODEL small

.STACK 100h

.CODE

.STARTUP

mov ax, not(not 0fh)

.EXIT 0

END

Additional reference words: 6.00 6.00a