This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: intermodule and comptypes - need some help


Geoff Keating <geoffk@geoffk.org> writes:

> "Zack Weinberg" <zack@codesourcery.com> writes:
>
>> A patch I'm working on has, as a side effect, that (in intermodule
>> mode) duplicate_decls may encounter two declarations from different
>> translation units at any time, not just during
>> merge_translation_unit_decls.
>
> I'd be interested to hear more details about how this happens.

The basic concept is, there's a scope (currently called
external_scope) which holds all TREE_PUBLIC declarations and possibly
some other things.  This scope is 'outer' to the file scope, and
persists across translation units.  Declarations in there are
invisible until a duplicate declaration of the same thing is
encountered.

The details are complicated, but I think the result winds up being
more straightforward and less buggy than what we have now.  If, that
is, I can make it work.

> I expect that at some point, some type gets created without the right
> context.  This would never have mattered before because nothing ever
> looked at the context of types (except in the objc compiler and then
> only in pretty special circumstances).

Thanks for the hint.  The predicate I wrote *should* work, then?

> If bootstrapping GCC is getting to be a pain, you might find the
> attached testcase helpful; you can modify it by assigning between x_1
> and x_2 in the different translation units, the assignment is valid in
> -6b but invalid (and requires a diagnostic) in -6a, and yet as written
> the two files are valid ISO C.

This is helpful, thanks, but it doesn't tickle the problem I am
seeing.  The problem is like this:

debug.h:127: error: conflicting types for 'dwarf_debug_hooks'
dwarfout.c:1275: error: previous declaration of 'dwarf_debug_hooks'

and, using your hint, I think I've tracked it to BLOCK_SUPERCONTEXT of
the block that's DECL_INITIAL of each translation_unit_decl not
getting initialized properly.  The types being handed to my predicate
*seem* to have the right TYPE_CONTEXTs.

zw


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