This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: check-init fix for PR 1328
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 10 Dec 2001 09:59:58 -0700
- Subject: Patch: check-init fix for PR 1328
- Reply-to: tromey at redhat dot com
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;