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]

set_block issue


This is called only when doing fixups.  However, poplevel is called,
so any old variables and subblocks in the old BLOCK will be clobbered.
This occured in Ada, but could occur in any language, so I committed the
patch below to both the mainline and GCC 3.0 branch.

Fri Feb 23 15:28:39 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* c-decl.c (set_block): Set NAMES and BLOCKS from BLOCK.
	* ch/decl.c, f/com.c, java/decl.c: Likewise.

*** c-decl.c	2001/02/21 14:42:09	1.210
--- c-decl.c	2001/02/23 19:27:09
*************** set_block (block)
*** 1261,1264 ****
--- 1261,1268 ----
  {
    current_binding_level->this_block = block;
+   current_binding_level->names = chainon (current_binding_level->names,
+ 					  BLOCK_VARS (block));
+   current_binding_level->blocks = chainon (current_binding_level->blocks,
+ 					   BLOCK_SUBBLOCKS (block));
  }
  
*** ch/decl.c	2001/01/29 02:46:26	1.30
--- ch/decl.c	2001/02/23 19:28:09
*************** set_block (block)
*** 3017,3020 ****
--- 3017,3023 ----
  {
    current_scope->this_block = block;
+   current_scope->decls = chainon (current_scope->decls, BLOCK_VARS (block));
+   current_scope->blocks = chainon (current_scope->blocks,
+ 				   BLOCK_SUBBLOCKS (block));
  }
  
*** f/com.c	2001/02/04 22:44:01	1.110
--- f/com.c	2001/02/23 19:28:58
*************** set_block (block)
*** 15175,15178 ****
--- 15175,15182 ----
  {
    current_binding_level->this_block = block;
+   current_binding_level->names = chainon (current_binding_level->names,
+ 					  BLOCK_VARS (block));
+   current_binding_level->blocks = chainon (current_binding_level->blocks,
+ 					   BLOCK_SUBBLOCKS (block));
  }
  
*** java/decl.c	2001/02/14 00:03:11	1.88
--- java/decl.c	2001/02/23 19:29:06
*************** set_block (block)
*** 1546,1549 ****
--- 1546,1553 ----
  {
    current_binding_level->this_block = block;
+   current_binding_level->names = chainon (current_binding_level->names,
+ 					  BLOCK_VARS (block));
+   current_binding_level->blocks = chainon (current_binding_level->blocks,
+ 					   BLOCK_SUBBLOCKS (block));
  }


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