BUG: /G3 /AL Options Generate Bad Code For Comparison to LongLast reviewed: July 22, 1997Article ID: Q115847 |
1.00 1.50
WINDOWS
kbtool kbbuglist
The information in this article applies to:
SYMPTOMSThe assembly code generated for the sample code below has an incorrect comparison to a long. This occurs when the /G3 compiler option (generate 386 instructions) is used in conjunction with the /AL option (large memory model).
RESOLUTIONThere are two possible workarounds.
STATUSMicrosoft has confirmed this to be a problem in the C++ compiler for MS-DOS, versions 8.0 and 8.0c. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONThe following is a sample that demonstrates the code generation problem. The incorrect assembly code can be examined by looking at the .COD file produced.
Sample Code
/* Compile options: /AL /Fc /G3 /c */ int go(long num, long base){ int negative; if( (num < 0L) && (base == 10L) ) // comparison { /*; from the .cod file ; ; Line 7 cmp DWORD PTR [bp+8],655360;000a0000H // should be 10 not 655360 jne SHORT $I107 cmp WORD PTR [bp+12],0 jne SHORT $I107 */ negative = 1; num = -num; } else negative = 0; return(negative);}
int main(){ long num, base; num = base = 10L; return(go(num, base));}
|
Additional reference words: 1.00 1.50 8.00 8.00c
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |