Optimization bug in x64 compiler when left shifting 64-bit value - by Miika Virtanen

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 678524 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/6/2011 1:32:51 AM
Access Restriction Public


Left shifting 64-bit variable more than 30 bits in a function which gets inlined and is called inside a loop creates wrong results when build with x64 compiler and optimizations.

The problem disappears with any of the following changes:
1. Optimizations are removed.
2. Function() is declared with __declspec(noinline).
3. Comment away the line which prints LSHIFT so it is not used elsewhere than in the calculation.
4. The for-loop around Function() call is removed.

While the sample itself is meaningless it is derived from a more complex use case with your sample code which slightly modified exhibits the same problem.
Sign in to post a comment.
Posted by Microsoft on 7/20/2011 at 3:55 PM
Miika, thank you for the bug report. We have confirmed that this is a bug. We will try to have this bug fixed in the next release.

Mark Levine
Visual C++
Posted by MS-Moderator07 [Feedback Moderator] on 7/7/2011 at 12:17 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 7/6/2011 at 1:50 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)