From 35a45bd40e2a9a5fa65efe7bc25e98fa8f8d7fdc Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 1 Oct 2008 07:28:04 -0700 Subject: [PATCH] re PR tree-optimization/35737 (ICE with __builtin_setjmp and complex variable) PR tree-opt/35737 * tree-complex.c (set_component_ssa_name): Don't optimize is_gimple_min_invariant values with ssa_names in abnormal phis. From-SVN: r140812 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/gcc.c-torture/compile/complex-6.c | 17 +++++++++++++++++ gcc/tree-complex.c | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/complex-6.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b6f16013f849..8dd8eb5c57e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-10-01 Richard Henderson + + PR tree-opt/35737 + * tree-complex.c (set_component_ssa_name): Don't optimize + is_gimple_min_invariant values with ssa_names in abnormal phis. + 2008-09-30 Paolo Bonzini PR tree-optimization/37662 diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-6.c b/gcc/testsuite/gcc.c-torture/compile/complex-6.c new file mode 100644 index 000000000000..eb89040abf3a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-6.c @@ -0,0 +1,17 @@ +/* PR tree-opt/35737 */ + +long buf[10]; + +int foo() +{ + __complex__ int i = 0; + + if (__builtin_setjmp(buf)) + { + i = 1; + bar(); + } + + return i == 0; +} + diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index bbf4c494218e..939bd6f1a63c 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -537,7 +537,8 @@ set_component_ssa_name (tree ssa_name, bool imag_p, tree value) /* If we've nothing assigned, and the value we're given is already stable, then install that as the value for this SSA_NAME. This preemptively copy-propagates the value, which avoids unnecessary memory allocation. */ - else if (is_gimple_min_invariant (value)) + else if (is_gimple_min_invariant (value) + && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name)) { VEC_replace (tree, complex_ssa_name_components, ssa_name_index, value); return NULL; -- 2.47.3