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

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 688139 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 9/13/2011 8:18:17 AM
Access Restriction Public


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
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 EricLeong [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(