Home Dashboard Directory Help
Search

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


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 723805
Opened: 2/7/2012 2:38:11 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

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

Details
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.

thanks,
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)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
testcase2.zip 2/7/2012 2 KB