]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/37042 (Strict-aliasing warnings are printed for _mm_load_si128,...
authorRichard Guenther <rguenther@suse.de>
Thu, 7 Aug 2008 10:01:48 +0000 (10:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 7 Aug 2008 10:01:48 +0000 (10:01 +0000)
2008-08-07  Richard Guenther  <rguenther@suse.de>

PR middle-end/37042
* tree-ssa-alias-warnings.c (nonstandard_alias_p): Ref-all
pointers can access anything.

* gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: New testcase.

From-SVN: r138837

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c [new file with mode: 0644]
gcc/tree-ssa-alias-warnings.c

index 8520ddf28a9a206f2821efc141abbe18977274eb..77ab7b7910a231fa7d81a52b4142c0cbee5ee7e1 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-07  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/37042
+       * tree-ssa-alias-warnings.c (nonstandard_alias_p): Ref-all
+       pointers can access anything.
+
 2008-08-06  Jan Hubicka  <jh@suse.cz>
 
        * optabs.c (emit_unop_insn): Break out to ...
index ce33d8e28161184c6c60fdbeccaeb76b546dca43..19032ca4f934c53acef88feaf65e37855f4e08ae 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-07  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/37042
+       * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: New testcase.
+
 2008-08-07  Andreas Krebbel  <krebbel1@de.ibm.com>
 
        * 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 (file)
index 0000000..ba7f85c
--- /dev/null
@@ -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;
+}
+
index 67d7f94ea3d4a8a94fa8f373e054d31d579d4044..5bae978187a66c1f4debeb54eab5cc598904c8ac 100644 (file)
@@ -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.  */