"Maximize speed" creates incorrect code - by ghazel

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 740487 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 5/4/2012 12:20:53 AM
Access Restriction Public


Using the "Maximize speed" option in Release mode produces incorrect results.
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:


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.