The information in this article applies to:
SYMPTOMSThe use of loop optimization (/Ol, or /Ox for the C/C++ compiler 8.0 for Windows NT) in a do-while loop that terminates after a single iteration may cause an infinite loop. The code below can be used to demonstrate this behavior. An infinite loop is generated when the expression (i <= e) from the program below is true during the first loop iteration. CAUSE
Examining the assembly/source code file generated by using the /Fc
compiler option reveals that the comparison operation differs with
the optimized and non-optimized versions. The optimized version will
only reenter the loop if the two values are not equal, whereas the
non-optimized version correctly checks if i is less than or equal to
e.
RESOLUTION
There are two workarounds to this problem:
-or- STATUSMicrosoft has confirmed this to be a bug in the products listed at the beginning of this article. This problem was corrected in the C/C++ compiler version 9.0, included with Visual C++ 32-bit Edition, version 2.0. MORE INFORMATIONThe following sample code can be used to demonstrate the problem. Sample Code
Additional query words: 6.00 6.00a 6.00ax 7.00 8.00 8.00c 1.00 1.50
Keywords : kbCodeGen |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |