The information in this article applies to:
SYMPTOMSCompiling code using the bitwise AND operator on signed integer literals in a conditional statement will produce incorrect results. CAUSE
The problem is that the 16-bit test instruction used by the version 8.0
compiler toggles the sign-bit flag. This triggers the JLE (Jump Less than
or Equal) to jump to the failure case when it should just fall thru to the
passing case.
Assembly code generated using the version 9.0 (x86) compiler:
RESOLUTIONCaste the integer literals to unsigned integers to force the correct results. For example, use:
-or-
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ version 2.0. MORE INFORMATIONSample Code to Reproduce Problem
Additional query words: 1.00 8.00 buglist1.00 fixlist2.00
Keywords : kbCodeGen |
Last Reviewed: January 18, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |