Unaligned data access optimzed away - by isjerl

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 646489 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/23/2011 11:42:58 AM
Access Restriction Public


Using the _mm_loadu_si128 compiler intrinsic with /O2, the compiler converts the unaligned load into an aligned load, causing a program to crash.

Example code:
#include <intrin.h>
int main()
	int data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
	__m128i temp1, temp2, prod;
	temp1 = _mm_loadu_si128((__m128i *) &data[0]);
	temp2 = _mm_loadu_si128((__m128i *) &data[5]);
	prod = _mm_mul_epi32(temp1, temp2);
	return _mm_extract_epi32(prod, 0);
Sign in to post a comment.
Posted by Microsoft on 2/25/2011 at 3:38 PM
Thanks for reporting this issue. I was able to reproduce the issue using the x64 targeting VS 2010 compiler (Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64).

The issue is fixed with the upcoming service pack (SP1) for VS 2010. You can download the beta for the service pack here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=11ea69cb-cf12-4842-a3d7-b32a1e5642e2.

VC++ Optimization and Code Generation Team
Posted by Microsoft on 2/23/2011 at 5:43 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 Microsoft on 2/23/2011 at 12:14 PM
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)