BUG: Global Optimizations Generate Incorrect Code When Using unions in a Loop (271874)
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 Q271874 SYMPTOMS
When a union value is modified by one member variable in a loop, but read by another variable in the same loop, global optimizer incorrectly moves the modification operation to outside the loop, which results in incorrect code generation.
Please refer to the sample code in the "More Information" section for details.
RESOLUTION
To work around the bug, turn off global optimization by using #pragma optimize.
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 KB271874 |
---|
|