Home Dashboard Directory Help
Search

Max Speed Optimization /O2 Generates Incorrect Result by Meng-Yuan Huang


Status: 

Closed


1
0
Sign in
to vote
Type: Bug
ID: 776967
Opened: 1/19/2013 7:05:50 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

The compiler switch "Max Speed Optimization /O2" is default turned on in Release configuration.
My program generates incorrect result if this switch is used.

Details
Sign in to post a comment.
Posted by Meng-Yuan Huang on 2/4/2013 at 5:29 PM
Hi Eric,

Thanks.

Regards,
Meng-Yuan Huang
Posted by Microsoft on 2/4/2013 at 12:12 PM
Hi, thanks for the latest update. I can reproduce the problem now -- this is a bug in the compiler optimizer that we will fix in a future release.

If you need a source code workaround, you can turn off optimizations around MergeSort() with:

#pragma optimize("", off)
void MergeSort(...)
{
...
}
#pragma optimize("", on)

or separate out MergeSort into its own .cpp file and configure the project to compile just that file with /Od.

I'm going to close this MSConnect item. Feel free to reply if you have any more questions.

Thanks,
Eric
Posted by Meng-Yuan Huang on 2/3/2013 at 5:31 AM
Hi Eric,

Sorry, the test program really needn't mat.h.
Today, I have upload a new version, which fixed this problem.
Please try it.

Thank you.

Regards,
Meng-Yuan Huang
Posted by Microsoft on 2/1/2013 at 2:16 PM
Hi, thanks for adding the new test. I am still not able to build the project. I am missing mat.h, and my team does not have a license to download Matlab.

In order to debug this, I need a project that does not depend on Matlab. Can you please provide that?

Thanks,
Eric
Posted by Meng-Yuan Huang on 1/25/2013 at 9:03 PM
Hi, I have solved the cmake issues. Please try test2.zip.

Thanks.
Regards,
Meng-Yuan Huang
Posted by Microsoft on 1/22/2013 at 3:18 PM
Hello, thanks for the report. I'm not able to build the project. I get cmd.exe errors trying to build -- they are likely cmake issues that do not appear related to the issue at hand.

Can you please provide a simple one-project solution that exhibits the same error without any extra dependencies? From your code, it looks like you should be able to extract the necessary components.

Thanks,
Eric Brumer
Microsoft Visual C++
Posted by Microsoft on 1/20/2013 at 9:33 PM
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 Microsoft on 1/19/2013 at 7:51 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  
VC11O2Bug.mp4 1/19/2013 13.03 MB
test.zip 1/19/2013 24.9 MB
test2.zip 1/25/2013 25.05 MB
test.zip 2/3/2013 14.55 MB