This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to expand_end_bindings


Avoids spurious warnings about falling off the end of the function in
the presence of automatic arrays with cleanups.  g++.warn/flow1.C.

2000-05-24  Jason Merrill  <jason@casey.soma.redhat.com>

	* stmt.c (expand_end_bindings): Look through NOTEs to find a
	BARRIER.

Index: stmt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/stmt.c,v
retrieving revision 1.144
diff -c -p -r1.144 stmt.c
*** stmt.c	2000/05/17 08:15:26	1.144
--- stmt.c	2000/05/25 00:15:44
*************** expand_end_bindings (vars, mark_ends, do
*** 3675,3682 ****
    if (thisblock->data.block.stack_level != 0
        || thisblock->data.block.cleanups != 0)
      {
!       /* Only clean up here if this point can actually be reached.  */
!       int reachable = GET_CODE (get_last_insn ()) != BARRIER;
  
        /* Don't let cleanups affect ({...}) constructs.  */
        int old_expr_stmts_for_value = expr_stmts_for_value;
--- 3675,3682 ----
    if (thisblock->data.block.stack_level != 0
        || thisblock->data.block.cleanups != 0)
      {
!       int reachable;
!       rtx insn;
  
        /* Don't let cleanups affect ({...}) constructs.  */
        int old_expr_stmts_for_value = expr_stmts_for_value;
*************** expand_end_bindings (vars, mark_ends, do
*** 3684,3689 ****
--- 3684,3695 ----
        tree old_last_expr_type = last_expr_type;
        expr_stmts_for_value = 0;
  
+       /* Only clean up here if this point can actually be reached.  */
+       insn = get_last_insn ();
+       if (GET_CODE (insn) == NOTE)
+ 	insn = prev_nonnote_insn (insn);
+       reachable = GET_CODE (insn) != BARRIER;
+       
        /* Do the cleanups.  */
        expand_cleanups (thisblock->data.block.cleanups, NULL_TREE, 0, reachable);
        if (reachable)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]