VS2010 C++ compiler produces incorrect code in release mode. - by Viesturs Zarins

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 723805 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/7/2012 2:38:11 AM
Access Restriction Public


The compiled C++ code produces  incorrect result in Release mode.

Sign in to post a comment.
Posted by Microsoft on 2/10/2012 at 10:02 AM
Glad to hear it. Thanks again for taking the time to report your issue.

ian Bearman
VC++ Code Generation And Optimization Team
Posted by Viesturs Zarins on 2/10/2012 at 1:10 AM
Works fine with VS2011 preview.
Posted by Viesturs Zarins on 2/8/2012 at 11:20 PM
Thanks for the quick response.
I will test the full code on VS2011 preview to see if it works.
Posted by Microsoft on 2/8/2012 at 11:35 AM
Thanks for reporting this. I can confirm that the problem has already been fixed and that recent builds of the compiler no longer generate the incorrect code. In addition the fix has been included in recent compiler releases (including the Windows 8 / Visual Studio 11 Developer Preview) and will be in the upcoming Visual Studio 11 Beta.

Please let me know if you need any additional support regarding this issue including workarounds or other questions.

ian Bearman
VC++ Code Generation And Optimization Team
Posted by MS-Moderator08 [Feedback Moderator] on 2/7/2012 at 9:14 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. 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 Viesturs Zarins on 2/7/2012 at 2:47 AM
Forgot to mention - 32bit x86 mode is used.
Posted by Viesturs Zarins on 2/7/2012 at 2:45 AM
The problem occours at line 71 ( tmp1 = left[i] ^ data[Bar(11, a_index0) & 0x7ff]; )

The assembly code for this line is as follows:

(Result of function Bar is in (cl,ch) and compiler tries to construct the array index in ecx.)
01291153 movzx     ecx,cl # overwrites the ch part with 0 and it's lost.
01291156 movzx     edx,ch
01291159 shl         edx,8
0129115C or         ecx,edx
0129115E and         ecx,7FFh
01291164 mov         al,byte ptr data[ecx]
0129116B xor         al,byte ptr left[esi]

Posted by MS-Moderator01 on 2/7/2012 at 2:42 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)