diff options
author | Jason Merrill <jason@redhat.com> | 2008-01-21 23:53:33 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2008-01-21 23:53:33 -0500 |
commit | 33b45227e0826ce8ddfe659c42f2c35cc0814065 (patch) | |
tree | 1cf758304e987f9c212d745d72e58a7eefe2e85f /gcc/tree-eh.c | |
parent | 9444edce910401a6aaf7fb7a535d52f6c2780be4 (diff) | |
download | gcc-33b45227e0826ce8ddfe659c42f2c35cc0814065.zip gcc-33b45227e0826ce8ddfe659c42f2c35cc0814065.tar.gz gcc-33b45227e0826ce8ddfe659c42f2c35cc0814065.tar.bz2 |
re PR c++/34196 (uninitialized variable warning in dead exception region)
PR c++/34196
* tree.h (TRY_CATCH_IS_CLEANUP): New macro.
* cp/decl.c (wrap_cleanups_r): Set TRY_CATCH_IS_CLEANUP.
* tree-eh.c (honor_protect_cleanup_actions): Strip TRY_CATCH_EXPR
if it is set.
From-SVN: r131710
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r-- | gcc/tree-eh.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 71d3d94..44d5a6d 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -840,6 +840,23 @@ honor_protect_cleanup_actions (struct leh_state *outer_state, if (this_state) finally = lower_try_finally_dup_block (finally, outer_state); + /* If this cleanup consists of a TRY_CATCH_EXPR with TRY_CATCH_IS_CLEANUP + set, the handler of the TRY_CATCH_EXPR is another cleanup which ought + to be in an enclosing scope, but needs to be implemented at this level + to avoid a nesting violation (see wrap_temporary_cleanups in + cp/decl.c). Since it's logically at an outer level, we should call + terminate before we get to it, so strip it away before adding the + MUST_NOT_THROW filter. */ + i = tsi_start (finally); + x = tsi_stmt (i); + if (protect_cleanup_actions + && TREE_CODE (x) == TRY_CATCH_EXPR + && TRY_CATCH_IS_CLEANUP (x)) + { + tsi_link_before (&i, TREE_OPERAND (x, 0), TSI_SAME_STMT); + tsi_delink (&i); + } + /* Resume execution after the exception. Adding this now lets lower_eh_filter not add unnecessary gotos, as it is clear that we never fallthru from this copy of the finally block. */ |