Home Dashboard Directory Help
Search

"Maximize speed" creates incorrect code by ghazel


Status: 

Closed
 as Fixed Help for as Fixed


2
0
Sign in
to vote
Type: Bug
ID: 740487
Opened: 5/4/2012 12:20:53 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
1
Workaround(s)
view
2
User(s) can reproduce this bug

Description

Using the "Maximize speed" option in Release mode produces incorrect results.
Details
Sign in to post a comment.
Posted by Microsoft on 5/7/2012 at 1:08 PM
Hi, thanks for the bug report. This is a compiler optimizer bug that is fixed in VS11 (it was fixed in the Beta release).

If you need a workaround for the VS 2010 compiler, you can turn off optimizations for the one specific function via:

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

If you feel you would like a hotfix for VS 2010, please visit the support site:

http://support.microsoft.com/common/international.aspx?RDPATH=dm;en-us;selectassist&target=assistance

Thanks,
Eric Brumer
Microsoft Visual C++
Posted by Jason Smestad on 5/4/2012 at 9:04 PM
Reduced test project: test740487.zip
Posted by MS-Moderator10 [Feedback Moderator] on 5/4/2012 at 3:16 AM
Thanks for your feedback. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 5/4/2012 at 12: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(http://support.microsoft.com)
Posted by ghazel on 5/4/2012 at 12:25 AM
The problem seems to occur around the check for the type of operation:


    if((request->operation & 0xFF) == 1) {
00E911B3 cmp         word ptr [esi],1
00E911B7 jne         do_scheduled_stream+0A5h (0E911C5h)

Comparing the word ptr esi to 1 is not the same as comparing the two masked bytes to 1.
Sign in to post a workaround.
Posted by Jason Smestad on 5/4/2012 at 9:06 PM
Add the following line to the source code:
#pragma optimize("y", on)
File Name Submitted By Submitted On File Size  
test740487.zip 5/4/2012 5 KB
main.c.zip 5/4/2012 1 KB