[Bug c/40120] New: aliasing of __m128i is not allowed
kretz at kde dot org
gcc-bugzilla@gcc.gnu.org
Tue May 12 13:29:00 GMT 2009
emmintrin.h says
/* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components. */
typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));
but the following testcase fails:
#include <emmintrin.h>
#include <stdio.h>
int main()
{
const __m128i d = _mm_set1_epi32(1);
int i;
for (i = 0; i < 4; ++i) {
if (((const int *)&d)[i] != 1) {
printf("%d %d %d %d\n",
((const int *)&d)[0],
((const int *)&d)[1],
((const int *)&d)[2],
((const int *)&d)[3]);
return 1;
}
}
return 0;
}
It does not fail when compiled with -fno-strict-aliasing. It also does not fail
when using __m128, _mm_set1_ps and casts to float *.
According to my tests the above does not fail with gcc 4.2, and still fails
with 4.4.0.
--
Summary: aliasing of __m128i is not allowed
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kretz at kde dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40120
More information about the Gcc-bugs
mailing list