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


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

Patch: PR 4489


This patch fixes PR 4489.
It works with no regressions on x86 Red Hat Linux 6.2.

The problem was that sometimes `body_block' would not start a new
block.  In this situation the switch rearrangement code would
rearrange the blocks into a circular structure, causing an infinite
loop in jc1.  We fix this by forcing a new block at the appropriate
moment.

This patch also includes a minor indentation fix.

Ok to commit?

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	Fix for PR java/4489:
	* jcf-write.c (generate_bytecode_insns) [SWITCH_EXPR]: Always
	force a new label when computing `body_block'.

Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.89
diff -u -r1.89 jcf-write.c
--- jcf-write.c 2001/09/17 17:03:13 1.89
+++ jcf-write.c 2001/10/08 19:30:00
@@ -1483,7 +1483,7 @@
 	    }
 	}
       break;
-      case COMPOUND_EXPR:	
+    case COMPOUND_EXPR:	
       generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET, state);
       generate_bytecode_insns (TREE_OPERAND (exp, 1), target, state);
       break;
@@ -1701,7 +1701,9 @@
 	sw_state.default_label = NULL;
 	generate_bytecode_insns (TREE_OPERAND (exp, 0), STACK_TARGET, state);
 	expression_last = state->last_block;
-	body_block = get_jcf_label_here (state);  /* Force a new block here. */
+	/* Force a new block here.  */
+	body_block = gen_jcf_label (state);
+	define_jcf_label (body_block, state);
 	generate_bytecode_insns (TREE_OPERAND (exp, 1), IGNORE_TARGET, state);
 	body_last = state->last_block;
 


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