BUG: Incorrect P-Code Generated for Large Integer ConstantLast reviewed: July 17, 1997Article ID: Q92730 |
7.00 7.00a | 1.00 1.50
MS-DOS | WINDOWSkbtool kbbuglist The information in this article applies to:
SYMPTOMSIn Microsoft C/C++ version 7.0 and Microsoft Visual C++ 1.0, using large constants in an arithmetic expression causes the compiler to generate erroneous code without issuing a warning or error message when the /Oq compiler option switch is specified.
CAUSEThe compiler is unable to correctly process a integer constant that is too large to be represented by a signed integer.
RESOLUTIONAppend the "L" suffix to the large integer constant to create a long constant. Doing so promotes other integers in the expression to type long as well.
STATUSMicrosoft has confirmed this to be a problem in CL.EXE versions 7.0, 7.0a, and 8.0. We are researching this problem, and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Sample Code:
/* * To demonstrate this error, compile the code below with both the /Oq * and /Fc compiler options. The /Fc option instructs the compiler to * generate a code listing. */ void main ( void ){ int i, j = -32009; i = j - 0x8001; // to correct use: i = j - 0x8001L; printf("i = %d\n", i);} The code listing does not indicate the incorrect integer constant.
|
Additional reference words: 7.00 8.00 8.00c 1.00 1.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |