Bad instruction re-ordering causes crash in code generated by MSVC 2010 - by chapmania

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 690294 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 9/22/2011 3:22:00 PM
Access Restriction Public


I have a short program that I believe causes MSVC 2010 to generate bad optimizations, leading to a crash at runtime.
It's valid C++ as far as I can tell. The debug build of this program runs fine.
Looking at the disassembly of the 'release' compile, it appears that some instruction re-ordering is a little over-zealous and causes the dereference of an invalid pointer.

I am using MSVC Express 2010, version "10.0.30319.1 RTMRel"
Sign in to post a comment.
Posted by Microsoft on 10/31/2011 at 11:34 AM

Thanks again for reporting this issue. It will be fixed in the next release of Visual Studio.

Shayne Hiet-Block
VC++ Code Generation and Optimization Team
Posted by Dmitry Me on 9/25/2011 at 11:42 PM
I also reproduce this in 2k10 SP1. Indeed machine code emitted first does the memory access, then the comparison.
Posted by MS-Moderator07 [Feedback Moderator] on 9/22/2011 at 10:58 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 MS-Moderator01 on 9/22/2011 at 3:44 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(