public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lee Iverson <leei@ai.sri.com>
To: egcs@cygnus.com
Cc: Jason Merrill <jason@cygnus.com>
Subject: Followup to templated label bug report.
Date: Mon, 15 Dec 1997 13:47:00 -0000	[thread overview]
Message-ID: <199712152147.NAA06614@Canada.AI.SRI.COM> (raw)

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;

                 reply	other threads:[~1997-12-15 13:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199712152147.NAA06614@Canada.AI.SRI.COM \
    --to=leei@ai.sri.com \
    --cc=egcs@cygnus.com \
    --cc=jason@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).