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

[gcjx] Patch: FYI: set DECL_CONTEXT correctly


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


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