Home Dashboard Directory Help
Search

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


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 678524
Opened: 7/6/2011 1:32:51 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

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.
http://msdn.microsoft.com/en-us/library/ms683194(v=vs.85).aspx
Details
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)
Sign in to post a workaround.