From c7d2d61d20c859ef2a9796c03b573204e7f2ae8c Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Mon, 24 Aug 1992 06:11:02 +0000 Subject: [PATCH] (expand_end_bindings): Generation of NOTE_INSN_BLOCK_END moved down so that it occurs after call to `expand_cleanups'. From-SVN: r1937 --- gcc/stmt.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gcc/stmt.c b/gcc/stmt.c index 71f15dd14a2..ee4e0e6a8ba 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2481,14 +2481,6 @@ expand_end_bindings (vars, mark_ends, dont_jump_in) && ! DECL_IN_SYSTEM_HEADER (decl)) warning_with_decl (decl, "unused variable `%s'"); - /* Mark the beginning and end of the scope if requested. */ - - if (mark_ends) - emit_note (NULL_PTR, NOTE_INSN_BLOCK_END); - else - /* Get rid of the beginning-mark if we don't make an end-mark. */ - NOTE_LINE_NUMBER (thisblock->data.block.first_insn) = NOTE_INSN_DELETED; - if (thisblock->exit_label) { do_pending_stack_adjust (); @@ -2670,6 +2662,16 @@ expand_end_bindings (vars, mark_ends, dont_jump_in) dont_jump_in); } + /* Mark the beginning and end of the scope if requested. + We do this now, after running cleanups on the variables + just going out of scope, so they are in scope for their cleanups. */ + + if (mark_ends) + emit_note (NULL_PTR, NOTE_INSN_BLOCK_END); + else + /* Get rid of the beginning-mark if we don't make an end-mark. */ + NOTE_LINE_NUMBER (thisblock->data.block.first_insn) = NOTE_INSN_DELETED; + /* If doing stupid register allocation, make sure lives of all register variables declared here extend thru end of scope. */ -- 2.30.2