This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix PR c++/6037
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: "jason at redhat dot com" <jason at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Mar 2002 14:16:39 -0500
- Subject: Re: [C++ PATCH] Fix PR c++/6037
- References: <20020322160305.E32482@sunsite.ms.mff.cuni.cz> <36540000.1016822007@gandalf.codesourcery.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Mar 22, 2002 at 10:33:27AM -0800, Mark Mitchell wrote:
> > enumtype = make_node (ENUMERAL_TYPE);
> > pushtag (name, enumtype, 0);
> > + if (current_class_type)
> > + {
> > + /* pushtag might have pushed the tag into some other binding
> > + level. */
> > + while (b && (b->tags == NULL || TREE_VALUE (b->tags) != enumtype))
> > + b = b->level_chain;
> > + if (b == NULL)
> > + abort ();
> > + TREE_ADDRESSABLE (b->tags) = 1;
> > + }
> > }
>
> I don't understand this change. What binding level did the enum get
> put in to?
current_binding_level at this point had tag_transparent 1 (because of
some cleanup), so pushtag put it one level up.
> Why not just call lookup_tag again after calling pushtag,
> rather than manipulating binding levels directly?
lookup_tag returns TREE_VALUE (b->tags), so setting
TREE_ADDRESSABLE (lookup_tag ()) is not the same as
TREE_ADDRESSABLE (b->tags).
> > - if (current_class_type)
> > - TREE_ADDRESSABLE (b->tags) = 1;
> > -
>
> What is the point of the TREE_ADDRESSABLE bits? I know they were
> alread there, but I don't remember them.
It has been there for eons:
Wed Jan 6 17:43:23 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
* cp-decl.c (current_local_enum): New variable.
(start_enum): Set TREE_ADDRESSABLE on the tag here, and clear
current_local_enum.
(build_enumerator): Build the field decl here, rather than in
grok_enum_decls; set its TREE_CHAIN to the current_local_enum.
(grok_enum_decls): Chain down, setting the type.
My bet would be it has something with obstacks, but I could be wrong.
Certainly gcc-2.4.5 doesn't reveal why it is used.
> Should we really be using
> some other macro that has a clearer name?
Definitely, if somebody tells me what it means (if anything).
I certainly cannot find anything about TREE_ADDRESSABLE on TREE_LIST
nodes.
Jakub