This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PR java/20522: ICE in update_aliases, at java/decl.c:163
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Fri, 18 Mar 2005 12:37:53 +0000
- Subject: PR java/20522: ICE in update_aliases, at java/decl.c:163
This is a case of confusion about variable ranges. The PC range
provided by the Java VM is inclusive at both ends, but we sometimes
treat it as a half-open range.
This doesn't usually matter, but in some corner cases we can trigger
sanity checks.
For 4.0 branch and trunk.
Andrew.
2005-03-18 Andrew Haley <aph@redhat.com>
* decl.c (update_aliases): Don't update variables that are about
to die.
(maybe_poplevels): Add comment.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.209
diff -u -p -r1.209 decl.c
--- decl.c 14 Feb 2005 14:58:22 -0000 1.209
+++ decl.c 18 Mar 2005 12:32:39 -0000
@@ -149,7 +149,10 @@ update_aliases (tree decl, int index, in
&& LOCAL_SLOT_P (tmp) == 0
&& (pc == -1
|| (pc >= DECL_LOCAL_START_PC (tmp)
- && pc <= DECL_LOCAL_END_PC (tmp)))
+ && pc < DECL_LOCAL_END_PC (tmp)))
+ /* This test is < (rather than <=) because there's no point
+ updating an alias that's about to die at the end of this
+ instruction. */
&& (tmp_type == decl_type
|| (INTEGRAL_TYPE_P (tmp_type)
&& INTEGRAL_TYPE_P (decl_type)
@@ -1741,6 +1744,12 @@ maybe_poplevels (int pc)
current_pc = pc;
#endif
+ /* FIXME: I'm pretty sure that this is wrong. Variable scopes are
+ inclusive, so a variable is live if pc == end_pc. Here, we
+ terminate a range if the current pc is equal to the end of the
+ range, and this is *before* we have generated code for the
+ instruction at end_pc. We're closing a binding level one
+ instruction too early. */
while (current_binding_level->end_pc <= pc)
poplevel (1, 0, 0);
}