Incorrect code generation for __restrict keyword with full optimization - by Ilya Grebnov

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 739798 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 4/29/2012 8:57:07 PM
Access Restriction Public


Please compile and test attached C++ application for Debug and Release targets. Note, this sample app is simplified version my actual application. Application is cross platform and work well with GCC, Clang and Intel C++, but crashes when compiled with Visual Studio 2010.
Sign in to post a comment.
Posted by Microsoft on 5/4/2012 at 8:02 AM
Hi, thanks for the bug report. The C++ compiler optimizer has struggled when a __restrict pointer is pointing to a local or global variable. I have fixed this for the VS11 release.

For what it's worth, __restrict gives the best performance benefits when you mark paramters to a function as being restrict (and to some extent, return values of functions). Setting, for example, int * __restrict p = &g; is a little weird. Regardless, I have fixed the bug in the optimizer -- we should not be generating bad code here.

You probably know this already, but if you need a workaround try removing __restrict.

Microsoft Visual C++
Posted by MS-Moderator07 [Feedback Moderator] on 4/30/2012 at 1:49 AM
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 4/29/2012 at 9:43 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(