]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/69551 (Wrong code with single element vector insert)
authorRichard Biener <rguenther@suse.de>
Fri, 26 Feb 2016 08:34:58 +0000 (08:34 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 26 Feb 2016 08:34:58 +0000 (08:34 +0000)
2016-02-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/69551
* tree-ssa-structalias.c (get_constraint_for_ssa_var): When
looking through aliases adjust DECL_PT_UID to refer to the
ultimate alias target.

* gcc.dg/torture/pr69951.c: New testcase.

From-SVN: r233734

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr69951.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 0414e0970130dbcc7e913e3485adac758b1a7b62..c4aa8c04a55da7600dea0bee2347b7c91d836537 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69551
+       * tree-ssa-structalias.c (get_constraint_for_ssa_var): When
+       looking through aliases adjust DECL_PT_UID to refer to the
+       ultimate alias target.
+
 2016-02-25  Martin Liska  <mliska@suse.cz>
 
        PR middle-end/69919
index 2e45a6a0b6ccf67c6d78ef5d46c9b26aa49bed35..5fdc3e354895e16ff2236a1af0055b5f9efeb660 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69551
+       * gcc.dg/torture/pr69951.c: New testcase.
+
 2016-02-25  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/48795
diff --git a/gcc/testsuite/gcc.dg/torture/pr69951.c b/gcc/testsuite/gcc.dg/torture/pr69951.c
new file mode 100644 (file)
index 0000000..cb46fef
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-require-alias "" } */
+
+extern void abort (void);
+
+int a = 1, c = 1;
+extern int b __attribute__((alias("a")));
+extern int d __attribute__((alias("c")));
+int main(int argc)
+{
+  int *p, *q;
+  if (argc)
+    p = &c, q = &d;
+  else
+    p = &b, q = &d;
+  *p = 1;
+  *q = 2;
+  if (*p == 1)
+    abort();
+  return 0;
+}
index d7a7dc554e4d70862f384651ee4b1da3cc8c279f..de123800f0b31403848cf91aac88d52749fdca72 100644 (file)
@@ -2943,6 +2943,14 @@ get_constraint_for_ssa_var (tree t, vec<ce_s> *results, bool address_p)
       if (node && node->alias && node->analyzed)
        {
          node = node->ultimate_alias_target ();
+         /* Canonicalize the PT uid of all aliases to the ultimate target.
+            ???  Hopefully the set of aliases can't change in a way that
+            changes the ultimate alias target.  */
+         gcc_assert ((! DECL_PT_UID_SET_P (node->decl)
+                      || DECL_PT_UID (node->decl) == DECL_UID (node->decl))
+                     && (! DECL_PT_UID_SET_P (t)
+                         || DECL_PT_UID (t) == DECL_UID (node->decl)));
+         DECL_PT_UID (t) = DECL_UID (node->decl);
          t = node->decl;
        }
     }