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 e98d7bba856b54eb53d239b7ecb1e4c9ee7a3789..f4ba0f525c16502984d12f225b7bb6c5f2c342b1 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 b2852caa449ee135ad09263a6872c6da49909502..e7867ec6b85b67e8ebb6c694ab6e6c7744fa5709 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 7dcb9ee49a43716eb3eaa354ec20b8e8f0e719c5..494158be0d188681505f3e5ffd07d78bf164803d 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;