From f26aa48e06db4d1e6724bfbc52ba466965719668 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Tue, 2 Nov 2010 16:58:40 +0000 Subject: [PATCH] re PR tree-optimization/46216 (ICE: SSA corruption) 2010-11-02 Richard Guenther PR tree-optimization/46216 * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Check if we can propagate from a POINTER_PLUS_EXPR before doing so. * gcc.dg/torture/pr46216.c: New testcase. From-SVN: r166203 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr46216.c | 24 ++++++++++++++++++++++++ gcc/tree-ssa-forwprop.c | 3 ++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr46216.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 05337716498..4a2611a3806 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-11-02 Richard Guenther + + PR tree-optimization/46216 + * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): + Check if we can propagate from a POINTER_PLUS_EXPR before doing so. + 2010-11-02 Rainer Orth * configure.ac (*-*-irix6*): Disable set_have_as_tls. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 44a575c2896..32fedf6b43c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-11-02 Richard Guenther + + PR tree-optimization/46216 + * gcc.dg/torture/pr46216.c: New testcase. + 2010-11-02 Rainer Orth PR target/46131 diff --git a/gcc/testsuite/gcc.dg/torture/pr46216.c b/gcc/testsuite/gcc.dg/torture/pr46216.c new file mode 100644 index 00000000000..b257dbf2cd5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr46216.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +typedef int Embryo_Cell; +int +embryo_program_run(Embryo_Cell *cip) +{ + unsigned char op; + Embryo_Cell offs; + static const void *switchtable[256] = { + &&SWITCHTABLE_EMBRYO_OP_NONE, &&SWITCHTABLE_EMBRYO_OP_LOAD_PRI + }; + for (;;) + { + op = *cip++; + while (1) { + goto *switchtable[op]; +SWITCHTABLE_EMBRYO_OP_LOAD_PRI: + offs = *(Embryo_Cell *)cip++; +SWITCHTABLE_EMBRYO_OP_NONE: + break; + }; + } + return offs; +} diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index f4808e78fff..a8284083067 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -1983,7 +1983,8 @@ tree_ssa_forward_propagate_single_use_vars (void) else gsi_next (&gsi); } - else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) + else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR + && can_propagate_from (stmt)) { if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST /* ??? Better adjust the interface to that function -- 2.30.2