re PR tree-optimization/82902 (ICE verify_ssa failed during GIMPLE pass: phiprop)
authorRichard Biener <rguenther@suse.de>
Thu, 9 Nov 2017 12:22:32 +0000 (12:22 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 9 Nov 2017 12:22:32 +0000 (12:22 +0000)
2017-11-09  Richard Biener  <rguenther@suse.de>

PR tree-optimization/82902
* tree-ssa-phiprop.c (propagate_with_phi): Test proper type.

* g++.dg/torture/pr82902.C: New testcase.

From-SVN: r254575

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr82902.C [new file with mode: 0644]
gcc/tree-ssa-phiprop.c

index e98d7bb..f4ba0f5 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/82902
+       * tree-ssa-phiprop.c (propagate_with_phi): Test proper type.
+
 2017-11-09  Martin Liska  <mliska@suse.cz>
 
        PR target/82863
index b2852ca..e7867ec 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/82902
+       * g++.dg/torture/pr82902.C: New testcase.
+
 2017-11-09  Martin Liska  <mliska@suse.cz>
 
        PR target/82863
diff --git a/gcc/testsuite/g++.dg/torture/pr82902.C b/gcc/testsuite/g++.dg/torture/pr82902.C
new file mode 100644 (file)
index 0000000..cc2ce27
--- /dev/null
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+typedef struct el_t {
+    el_t *next;
+    int elem[];
+} EL;
+el_t a, c;
+void *b;
+void *fn1() {
+    if (b)
+      return a.elem;
+    return c.elem;
+}
+typedef struct {
+    int x;
+} EV_T;
+EV_T *d;
+void fn2() {
+    EV_T *e = (EV_T *)fn1();
+    d[0] = *e;
+}
index 7dcb9ee..494158b 100644 (file)
@@ -354,7 +354,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
 
       /* Found a proper dereference with an aggregate copy.  Just
          insert aggregate copies on the edges instead.  */
-      if (!is_gimple_reg_type (TREE_TYPE (TREE_TYPE (ptr))))
+      if (!is_gimple_reg_type (TREE_TYPE (gimple_assign_lhs (use_stmt))))
        {
          if (!gimple_vdef (use_stmt))
            goto next;