Microsoft KB Archive/92730

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

BUG: Incorrect P-Code Generated for Large Integer Constant

Q92730

7.00 7.00a | 1.00 1.50 MS-DOS | WINDOWS kbtool kbbuglist ---------------------------------------------------------------------- The information in this article applies to: - The Microsoft C/C++ Compiler (CL.EXE), included with: - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 ---------------------------------------------------------------------- SYMPTOMS ======== In 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. CAUSE ===== The compiler is unable to correctly process a integer constant that is too large to be represented by a signed integer. RESOLUTION ========== Append 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. STATUS ====== Microsoft 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 KBCategory: kbtool kbbuglist KBSubcategory: CLIss

Keywords : kb16bitonly
Issue type :
Technology : kbVCsearch kbAudDeveloper kbCVCComp


Last Reviewed: May 5, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.