FIX: No Code Generated for Assignment StatementLast reviewed: September 18, 1997Article ID: Q114072 |
7.00 | 1.00
MS-DOS | WINDOWS
kbtool kbfixlist kbbuglist
The information in this article applies to:
SYMPTOMSNo code is generated for an assignment statement. In the following sample, the program never terminates because no code is generated for the statement that sets the condition for terminating the loop.
CAUSEThis problem occurs when one or more of the -Oe, -Og, and -Ol optimizations are used.
RESOLUTIONTo avoid the problem disable the optimizations. This can be done by either not using the /Oe, Og or /Ol options on the command line or by using #pragma optimize to disable the optimizations in the source file. The comments in the sample below demonstrate using #pragma optimize statements to work around the problem.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed above. This is not a problem in Visual C++, 32-bit Edition. This problem was corrected in Visual C++ version 1.5.
Sample Code
/* Compile options needed: /Oe, /Og, /Ol, or any combination of these */ #include <stdio.h>static int fault = 0, state ;
// Uncomment for work around // #pragma optimize ("egl", off) int TestFunc (void){ if (state == 2) { state=0; // No code generated for this block /* state=0; */ // Works if this line's comment is removed if (fault == 0) return(1); else return(-1); } else return(0); } // Uncomment for work around // #pragma optimize ("", on) void main(void){ state = 2; while ( TestFunc() == 1) printf("Should loop once.\n"); } |
Additional reference words: 7.00 8.00 1.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |