BUG: Bad Code Generation with Global Optimization (254226)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q254226 SYMPTOMS
The global optimizer may generate incorrect code if two if statements have identical conditional clauses that create side effects. Please refer to the sample code in the "More Information" section for details.
RESOLUTION
Following are two possible ways to work around this problem: - Use the #pragma optimize("g",off) method to turn off global optimization at the function level. By making the function inline and compiling with the /Ob1 or /Ob2 compiler switches also alleviates this problem.
- Modify the code to avoid the construct in workaround number one. For example, when you change the second if statement to else if this change generates the correct code.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbBug kbCodeGen kbCompiler kbpending KB254226 |
---|
|