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] Java: minor patch.


This patch further this patch:
http://gcc.gnu.org/ml/gcc-patches/2000-02/msg00696.html and offers
better handling of corner cases. I just checked it in.

./A

Mon Mar 20 08:58:51 2000  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* jcf-write.c (generate_bytecode_insns): TRY_FINALLY_EXPR:
	properly initialize `finished_label.' Don't emit gotos for empty
	try statement.

Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/jcf-write.c,v
retrieving revision 1.50
diff -u -p -r1.50 jcf-write.c
--- jcf-write.c	2000/03/14 05:01:04	1.50
+++ jcf-write.c	2000/03/22 22:31:42
@@ -2317,8 +2317,9 @@ generate_bytecode_insns (exp, target, st
 	tree finally = TREE_OPERAND (exp, 1);
 	tree return_link, exception_decl;
 
-	finished_label = finally_label = start_label = NULL;
+	finally_label = start_label = NULL;
 	return_link = exception_decl = NULL_TREE;
+	finished_label = gen_jcf_label (state);
 
 	/* If the finally clause happens to be empty, set a flag so we
            remember to just skip it. */
@@ -2333,7 +2334,6 @@ generate_bytecode_insns (exp, target, st
 	    exception_type = build_pointer_type (throwable_type_node);
 	    exception_decl = build_decl (VAR_DECL, NULL_TREE, exception_type);
 
-	    finished_label = gen_jcf_label (state);
 	    finally_label = gen_jcf_label (state);
 	    start_label = get_jcf_label_here (state);
 	    finally_label->pc = PENDING_CLEANUP_PC;
@@ -2352,7 +2352,8 @@ generate_bytecode_insns (exp, target, st
 	    emit_jsr (finally_label, state);
 	  }
 
-	if (CAN_COMPLETE_NORMALLY (try_block))
+	if (CAN_COMPLETE_NORMALLY (try_block)
+	    && BLOCK_EXPR_BODY (try_block) != empty_stmt_node)
 	  emit_goto (finished_label, state);
 
 	/* Handle exceptions. */

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