aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-08-07 10:01:48 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-08-07 10:01:48 +0000
commit9aa4d3c1cbd78511c868b2361eb033d685e1dc25 (patch)
tree06cb786d8a360c118a8f2be8fafa3fa8b87513b8 /gcc
parent18bd082d900d085c09132cc66cec118dd2037fc2 (diff)
downloadgcc-9aa4d3c1cbd78511c868b2361eb033d685e1dc25.zip
gcc-9aa4d3c1cbd78511c868b2361eb033d685e1dc25.tar.gz
gcc-9aa4d3c1cbd78511c868b2361eb033d685e1dc25.tar.bz2
re PR middle-end/37042 (Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c24
-rw-r--r--gcc/tree-ssa-alias-warnings.c4
4 files changed, 39 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8520ddf..77ab7b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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 ...
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ce33d8e..19032ca 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..ba7f85c
--- /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 67d7f94..5bae978 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. */