public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Followup to templated label bug report.
@ 1997-12-15 13:47 Lee Iverson
  0 siblings, 0 replies; only message in thread
From: Lee Iverson @ 1997-12-15 13:47 UTC (permalink / raw)
  To: egcs; +Cc: Jason Merrill

WRT. the code in Set.instance.i, it seems that CoolSet<void*>::resize
is being instantiated inside CoolSetCoolSet<void*>::put, and thus
push_to_top_level is called.  Now, the id for retry is shared between
the minimal_parse'ed versions of the two templated functions, but
maybe_push_to_top_level clears named_labels but does not clear the
individual bindings stored in IDENTIFIER_LABEL_VALUE for each label.

It seems to me that what must be done is to actually save these
bindings in maybe_push_to_top_level and then restore them in
pop_from_top_level.  The patch below implements this and fixes the bug
I previously reported.

-------------------------------------------------------------------------------
Lee Iverson     		SRI International
leei@ai.sri.com			333 Ravenswood Ave., Menlo Park CA 94025
http://www.ai.sri.com/~leei/	(650) 859-3307

1997-12-15  Lee Iverson  <leei@Canada.AI.SRI.COM>

	* decl.c (struct saved_scope): Add label_bindings component for
	save/restore of label bindings.
	(maybe_push_to_top_level): Save label bindings in named_labels to
	label_bindings.
	(pop_from_top_level): Restore named_labels from label_bindings.

*** decl.c.~1~	Sat Dec  6 16:30:39 1997
--- decl.c	Mon Dec 15 13:38:05 1997
*************** struct saved_scope {
*** 1832,1835 ****
--- 1832,1836 ----
    HOST_WIDE_INT processing_template_decl;
    tree previous_class_type, previous_class_values;
+   tree label_bindings;
  };
  static struct saved_scope *current_saved_scope;
*************** maybe_push_to_top_level (pseudo)
*** 1886,1889 ****
--- 1887,1891 ----
    struct binding_level *b = inner_binding_level;
    tree old_bindings = NULL_TREE;
+   tree link;
  
    if (current_function_decl)
*************** maybe_push_to_top_level (pseudo)
*** 1916,1919 ****
--- 1918,1933 ----
    current_binding_level = b;
  
+   /* Save current label bindings. */
+   s->label_bindings = NULL_TREE;
+   for (link = named_labels; link; link = TREE_CHAIN (link))
+     {
+       tree label = TREE_VALUE (link);
+       tree name = DECL_NAME (label);
+       s->label_bindings = tree_cons (label, 
+ 				     IDENTIFIER_LABEL_VALUE (name),
+ 				     s->label_bindings);
+       SET_IDENTIFIER_LABEL_VALUE (name, NULL_TREE);
+     }
+ 
    s->class_name = current_class_name;
    s->class_type = current_class_type;
*************** pop_from_top_level ()
*** 1989,1992 ****
--- 2003,2016 ----
  	}
      }
+ 
+   named_labels = NULL_TREE;
+   for (t = s->label_bindings; t; t = TREE_CHAIN (t))
+     {
+       tree decl = TREE_PURPOSE (t);
+       tree val = TREE_VALUE (t);
+       SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (decl), val);
+       named_labels = tree_cons (NULL_TREE, decl, named_labels);
+     }
+ 
    current_class_name = s->class_name;
    current_class_type = s->class_type;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-12-15 13:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-15 13:47 Followup to templated label bug report Lee Iverson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).