This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: TRANSLATION_UNIT_DECL breaks bootstrap
Op za 12-07-2003, om 03:13 schreef Geoff Keating:
> Mark Mitchell <mark@codesourcery.com> writes:
>
> > Geoff --
> >
> > Your patch breaks i686-pc-linux-gnu.
> >
> > The problem is that there is code that expects that file-scope
> > variables have NULL DECL_CONTEXT, and that is no longer true.
>
> I hope not. I thought I got all those places.
Well certainly something is wrong because i686 doesn't bootstrap. :-)
>
> Steven commented:
>
> > Maybe there should be a macro HAS_FILE_SCOPE in tree.h??
As I was thinking about this a little further I was wondering why
DECL_CONTEXT should ever be NULL after this patch. Why not just
_always_ put a TRANSLATION_UNIT_DECL in DECL_CONTEXT if the entity is
global, even if gcc is not doing intermodule stuff.
> I haven't yet found a need for it. I think file scope (or,
> technically, translation unit scope) is a language-specific
> concept---I can certainly imagine languages where it is
> meaningless---and so it probably shouldn't appear in the middle-end.
> Usually, you want TREE_PUBLIC or TREE_STATIC or DECL_EXTERNAL instead.
Well, we should define some semantics for this; after all, trees should
be language-independent for tree-ssa.
Defining it as indicating "at least visible within this translation
unit" seems quite reasonable since that is what DECL_CONTEXT==NULL means
without your patch. How languages otherwise define the scope of
declarations is up to them.
Gr.
Steven