diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8520ddf28a9..77ab7b7910a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-08-07 Richard Guenther + + PR middle-end/37042 + * tree-ssa-alias-warnings.c (nonstandard_alias_p): Ref-all + pointers can access anything. + 2008-08-06 Jan Hubicka * optabs.c (emit_unop_insn): Break out to ... diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce33d8e2816..19032ca4f93 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-07 Richard Guenther + + PR middle-end/37042 + * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: New testcase. + 2008-08-07 Andreas Krebbel * gcc.c-torture/compile/20080806-1.c: Move testcase ... diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c new file mode 100644 index 00000000000..ba7f85c18e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wall" } */ + +typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); + +extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_mm_load_si128 (__m128i const *__P) +{ + return *__P; +} + +static const short __attribute__((__aligned__(16))) tbl[8] = +{ 1, 2, 3, 4, 5, 6, 7, 8}; + + +__m128i get_vec(void) +{ + __m128i ret; + + ret = _mm_load_si128((__m128i *)tbl); /* { dg-bogus "type-punning" } */ + + return ret; +} + diff --git a/gcc/tree-ssa-alias-warnings.c b/gcc/tree-ssa-alias-warnings.c index 67d7f94ea3d..5bae978187a 100644 --- a/gcc/tree-ssa-alias-warnings.c +++ b/gcc/tree-ssa-alias-warnings.c @@ -889,6 +889,10 @@ nonstandard_alias_p (tree ptr, tree alias, bool ptr_ptr) tree ptr_type = get_otype (ptr, true); tree alias_type = get_otype (alias, ptr_ptr); + /* If this is a ref-all pointer the access is ok. */ + if (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (ptr))) + return false; + /* XXX: for now, say it's OK if the alias escapes. Not sure this is needed in general, but otherwise GCC will not bootstrap. */