diff options
author | Richard Guenther <rguenther@suse.de> | 2011-01-14 13:20:22 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-01-14 13:20:22 +0000 |
commit | 0fdb0d27c2dbfa8fffddf95a6df3822a771b0ffb (patch) | |
tree | 416da2ccce41a8bb452b079c2b37c89a1abdc2dd /gcc | |
parent | 35385f991f052ff58476c64ed62b09751e55e31a (diff) | |
download | gcc-0fdb0d27c2dbfa8fffddf95a6df3822a771b0ffb.zip gcc-0fdb0d27c2dbfa8fffddf95a6df3822a771b0ffb.tar.gz gcc-0fdb0d27c2dbfa8fffddf95a6df3822a771b0ffb.tar.bz2 |
re PR tree-optimization/47280 (ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions -ftrapv)
2011-01-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47280
* tree-ssa-forwprop.c (associate_plusminus): Cleanup EH and
return CFG changes.
(tree_ssa_forward_propagate_single_use_vars): Deal with
CFG changes from associate_plusminus.
* g++.dg/opt/pr47280.C: New testcase.
From-SVN: r168784
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr47280.C | 15 | ||||
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 13 |
4 files changed, 37 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad614d3..fab41be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2011-01-14 Richard Guenther <rguenther@suse.de> + PR tree-optimization/47280 + * tree-ssa-forwprop.c (associate_plusminus): Cleanup EH and + return CFG changes. + (tree_ssa_forward_propagate_single_use_vars): Deal with + CFG changes from associate_plusminus. + +2011-01-14 Richard Guenther <rguenther@suse.de> + PR middle-end/47281 Revert 2011-01-11 Richard Guenther <rguenther@suse.de> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fa8f110..ed36768 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-01-14 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/47280 + * g++.dg/opt/pr47280.C: New testcase. + 2011-01-14 Jason Merrill <jason@redhat.com> * g++.dg/cpp0x/constexpr-regress1.C: New. diff --git a/gcc/testsuite/g++.dg/opt/pr47280.C b/gcc/testsuite/g++.dg/opt/pr47280.C new file mode 100644 index 0000000..01ca484 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr47280.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-options "-O -fnon-call-exceptions -ftrapv" } + +void bar (int n, char *p) +{ + try + { + n++; + for (int i = 0; i < n - 1; i++) + p[i]; + } + catch (...) + {} +} + diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index f68395a..64c8e88 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -1658,9 +1658,9 @@ simplify_bitwise_and (gimple_stmt_iterator *gsi, gimple stmt) /* Perform re-associations of the plus or minus statement STMT that are - always permitted. */ + always permitted. Returns true if the CFG was changed. */ -static void +static bool associate_plusminus (gimple stmt) { tree rhs1 = gimple_assign_rhs1 (stmt); @@ -1671,7 +1671,7 @@ associate_plusminus (gimple stmt) /* We can't reassociate at all for saturating types. */ if (TYPE_SATURATING (TREE_TYPE (rhs1))) - return; + return false; /* First contract negates. */ do @@ -1934,7 +1934,12 @@ out: { fold_stmt_inplace (stmt); update_stmt (stmt); + if (maybe_clean_or_replace_eh_stmt (stmt, stmt) + && gimple_purge_dead_eh_edges (gimple_bb (stmt))) + return true; } + + return false; } /* Main entry point for the forward propagation optimizer. */ @@ -2062,7 +2067,7 @@ tree_ssa_forward_propagate_single_use_vars (void) else if (gimple_assign_rhs_code (stmt) == PLUS_EXPR || gimple_assign_rhs_code (stmt) == MINUS_EXPR) { - associate_plusminus (stmt); + cfg_changed |= associate_plusminus (stmt); gsi_next (&gsi); } else |