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]
Other format: [Raw text]

Patch: check-init fix for PR 1328


This patch fixes PR 1328.
The problem is that check-init doesn't correctly merge in the
pre-switch state if the switch is missing a `default' statement.

Ok?

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	Fix for PR java/1328:
	* check-init.c (check_init) [SWITCH_EXPR]: If switch doesn't have
	default case, merge in state preceding switch.

Index: check-init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/check-init.c,v
retrieving revision 1.38
diff -u -r1.38 check-init.c
--- check-init.c 2001/12/09 23:43:19 1.38
+++ check-init.c 2001/12/10 16:54:04
@@ -694,6 +694,8 @@
 	alt.block = exp;
 	check_init (TREE_OPERAND (exp, 1), before);
 	done_alternative (before, &alt);
+	if (! SWITCH_HAS_DEFAULT (exp))
+	  done_alternative (alt.saved, &alt);
 	FREE_BUFFER(alt.saved, buf);
 	END_ALTERNATIVES (before, alt);
 	return;


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