Optimizer uses 64bit operation instead of 32bit operation - by Martin Ankerl

Status : 

 


2
0
Sign in
to vote
ID 3125746 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 3/1/2017 2:47:26 AM
Access Restriction Public

Description

The compiler erroneously replaces a 32bit operation with a 64bit operation, leading to wrong calculation results. This problem occurs only in 64bit and with /O2 or above. The same error seems to occur in VS2010 and VS2013.
Sign in to post a comment.
Posted by Rui [MSFT] on 4/19/2017 at 2:57 PM
Sorry for the duplicated reply due to some system glitch.

Thanks,
Rui Zhang
Microsoft Visual C++ Team
Posted by Rui [MSFT] on 4/19/2017 at 2:53 PM
Thank you for reporting this issue. This is due to a bug in the loop optimizer. We have fixed this bug in VS2017 RTM.
 
In the meantime if you need a source code workaround, please use #pragma optimize( "", off ) and #pragma optimize( "", on ) around
the affected function. The affected function should have a loop with unsigned induction variable. The induction variable multiplies with some value and its result overflows.
 
If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to http://support.microsoft.com or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.
 
I am closing this MSConnect item. Feel free to respond if you need anything else.
 
Thanks,
Rui Zhang
Microsoft Visual C++ Team
Posted by Rui [MSFT] on 4/19/2017 at 2:53 PM
Thank you for reporting this issue. This is due to a bug in the loop optimizer. We have fixed this bug in VS2017 RTM.
 
In the meantime if you need a source code workaround, please use #pragma optimize( "", off ) and #pragma optimize( "", on ) around
the affected function. The affected function should have a loop with unsigned induction variable. The induction variable multiplies with some value and its result overflows.
 
If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to http://support.microsoft.com or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.
 
I am closing this MSConnect item. Feel free to respond if you need anything else.
 
Thanks,
Rui Zhang
Microsoft Visual C++ Team
Posted by Rui [MSFT] on 4/19/2017 at 2:53 PM
Thank you for reporting this issue. This is due to a bug in the loop optimizer. We have fixed this bug in VS2017 RTM.
 
In the meantime if you need a source code workaround, please use #pragma optimize( "", off ) and #pragma optimize( "", on ) around
the affected function. The affected function should have a loop with unsigned induction variable. The induction variable multiplies with some value and its result overflows.
 
If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to http://support.microsoft.com or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.
 
I am closing this MSConnect item. Feel free to respond if you need anything else.
 
Thanks,
Rui Zhang
Microsoft Visual C++ Team
Posted by Rui [MSFT] on 4/19/2017 at 2:53 PM
Thank you for reporting this issue. This is due to a bug in the loop optimizer. We have fixed this bug in VS2017 RTM.
 
In the meantime if you need a source code workaround, please use #pragma optimize( "", off ) and #pragma optimize( "", on ) around
the affected function. The affected function should have a loop with unsigned induction variable. The induction variable multiplies with some value and its result overflows.
 
If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to http://support.microsoft.com or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.
 
I am closing this MSConnect item. Feel free to respond if you need anything else.
 
Thanks,
Rui Zhang
Microsoft Visual C++ Team
Posted by Martin Ankerl on 3/1/2017 at 9:35 PM
According to ginny2016, this bug appears in Visual Studio 2015 Update 3, 2013, 2010, 2008 64-bit mode when an optimizer flag was used (/O2 and /O1).
See https://www.reddit.com/r/cpp/comments/5wwmi2/visual_studio_2015_compiler_bug_64bit_instead_of/dedzh5g/
Posted by Microsoft on 3/1/2017 at 4:21 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted.

Microsoft Visual Studio Connect Support Team
Posted by ildjarn on 3/1/2017 at 3:48 PM
This appears to be fixed as of compiler version 19.10.25027.