BUG: Bad Code Is Generated by Global Optimizations When Bitwise Shift Operators Are Used (250887)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0 SP3
- Microsoft Visual C++, 32-bit Professional Edition 6.0 SP3
- Microsoft Visual C++, 32-bit Learning Edition 6.0 SP3
This article was previously published under Q250887 SYMPTOMS
For builds that use global optimizations (/Og), an if statement may never be executed when the bitwise shift operator, >> or <<, is called after the if statement.
NOTE: Both the "maximize speed" (/O2) and "minimize size" (/O1) optimizations are composite optimization switches that include /Og.
CAUSE
The optimizer has incorrectly removed a CMP instruction.
RESOLUTION
To resolve this problem, disable the global optimizations.
Global optimizations can be turned off on a function-by-function basis
by using the #pragma optimize("g",off) directive.
Global optimizations can also be turned off by adding /Og- to a source file or to a project's settings.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 11/18/2003 |
---|
Keywords: | kbBug kbCodeGen kbCompiler KB250887 |
---|
|