This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: set DECL_CONTEXT correctly
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 03 Apr 2005 17:56:24 -0600
- Subject: [gcjx] Patch: FYI: set DECL_CONTEXT correctly
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This fixes a bug in the bytecode lowering code. We weren't setting
DECL_CONTEXT on local variables, leading to a crash.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* lower.cc (visit_bytecode_block): Set DECL_CONTEXT on stack and
local variables. Correctly set local_slots[] elements.
Index: lower.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/lower.cc,v
retrieving revision 1.1.2.12
diff -u -r1.1.2.12 lower.cc
--- lower.cc 3 Apr 2005 23:56:05 -0000 1.1.2.12
+++ lower.cc 3 Apr 2005 23:57:19 -0000
@@ -106,14 +106,20 @@
sprintf (name, "stack%d", i);
stack_slots[i] = build_decl (VAR_DECL, get_identifier (name),
type_slot_union);
+ DECL_CONTEXT (stack_slots[i]) = current_block;
+ TREE_CHAIN (stack_slots[i]) = BLOCK_VARS (current_block);
+ BLOCK_VARS (current_block) = stack_slots[i];
}
local_slots = new tree[max_locals];
for (int i = 0; i < max_locals; ++i)
{
char name[20];
sprintf (name, "local%d", i);
- stack_slots[i] = build_decl (VAR_DECL, get_identifier (name),
+ local_slots[i] = build_decl (VAR_DECL, get_identifier (name),
type_slot_union);
+ DECL_CONTEXT (local_slots[i]) = current_block;
+ TREE_CHAIN (local_slots[i]) = BLOCK_VARS (current_block);
+ BLOCK_VARS (current_block) = local_slots[i];
}
model_unit_class *unit