Microsoft KB Archive/114072

{|
 * width="100%"|

FIX: No Code Generated for Assignment Statement

 * }

Q114072

7.00 | 1.00 MS-DOS | WINDOWS kbtool kbfixlist kbbuglist -- The information in this article applies to: - The Microsoft C/C++ Compiler (CL.EXE), included with: - Microsoft C/C++ compiler for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, version 1.0 -- SYMPTOMS ======== No 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. CAUSE ===== This problem occurs when one or more of the -Oe, -Og, and -Ol optimizations are used. RESOLUTION ========== To 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. STATUS ====== Microsoft 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 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 KBCategory: kbtool kbfixlist kbbuglist KBSubcategory: CLIss

Keywords : kb16bitonly kbCompiler

Issue type :

Technology : kbVCsearch kbAudDeveloper kbCVCComp