From a5bd402701fa7c9e5d1d81ca1bf76106ec9a7785 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 9 Nov 2017 12:22:32 +0000 Subject: [PATCH] re PR tree-optimization/82902 (ICE verify_ssa failed during GIMPLE pass: phiprop) 2017-11-09 Richard Biener 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 | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr82902.C | 21 +++++++++++++++++++++ gcc/tree-ssa-phiprop.c | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr82902.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e98d7bba856..f4ba0f525c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-11-09 Richard Biener + + PR tree-optimization/82902 + * tree-ssa-phiprop.c (propagate_with_phi): Test proper type. + 2017-11-09 Martin Liska PR target/82863 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2852caa449..e7867ec6b85 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-11-09 Richard Biener + + PR tree-optimization/82902 + * g++.dg/torture/pr82902.C: New testcase. + 2017-11-09 Martin Liska 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 index 00000000000..cc2ce271d4c --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr82902.C @@ -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; +} diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c index 7dcb9ee49a4..494158be0d1 100644 --- a/gcc/tree-ssa-phiprop.c +++ b/gcc/tree-ssa-phiprop.c @@ -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; -- 2.30.2