Home Dashboard Directory Help
Search

Visual Studio 2010 SP1 Release x64 /O2 optimization bug (c2.dll version 10.00.40219.1 amd64) by btomko


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 688139
Opened: 9/13/2011 8:18:17 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Open a big endian binary file containing integers 15, 3, 6, 9, 12. Create a union to read 4 bytes at a time from the file. Create an integer called FIRST_INT_READ and set it equal to the first integer read from the bytestream (which is 15). Read the bytestream two more times in a loop into the union. Try now to use FIRST_INT_READ as the stopping criteria in a nested for loop. FIRST_INT_READ now has a value of the third position in the bytestream which is integer 6, unless you cout FIRST_INT_READ inside the for loop. Workarounds include:
1.) compiling in 32 bit mode
2.) turning off optimization in 64 bit
3.) declaring FIRST_INT_READ as volatile
Details
Sign in to post a comment.
Posted by Microsoft on 9/30/2011 at 11:42 AM
This was an issue in the optimizer and has been fixed. The fix will appear in a subsequent release of the compiler. Thank you very much for reporting this issue and making our product better.

David Gillies
VC++ Optimizer Team
Posted by MS-Moderator09 [Feedback Moderator] on 9/13/2011 at 8:15 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 9/13/2011 at 8:43 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
test.bin 9/13/2011 20 bytes
bug.cpp 9/13/2011 1 KB