https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61886

--- Comment #34 from Zack Weinberg <zackw at panix dot com> ---
> As I tried to explain, it is currently design decision to have one declaration
> and one symtam node for one symbol.  The one decl rule was introduced by
> Codesourcery (Zack) in 2003-4. He updated frontends to avoid copying and
> dropped code that dealt with duplicated declarations.  Due to lack of sanity
> checking some cases remained, like this one (because at that time we did not
> really have proper asm name hash).  There are couple open PRs since that time
> that was never corrected.

It's been long enough that I don't recall precisely what my goals were, but I
don't think it was my intention to enforce a "one decl per asm name" rule at
the time.  I was trying to deal with C front-end issues: according to
https://gcc.gnu.org/ml/gcc-patches/2004-01/msg00808.html, "at least bug 12267,
bug 12336, bug 12373, bug 12391, bug 12560, bug 12934, bug 13129".  My
recollection is that the fundamental problem was getting more than one
TREE_DECL object per *declared name* in -funit-at-a-time mode, which was shiny
and new back then!

... Digging through the mailing list archives, maybe I'm remembering wrong. 
https://gcc.gnu.org/ml/gcc-patches/2004-03/msg01440.html has

> The old code took the copying
> approach; this was bad because it violated the basic assumption made
> elsewhere in the compiler that there is exactly one DECL node for each
> assembly-level symbol.  Hence all the bugs.

I do not remember anymore what parts of the compiler were making those
assumptions, but I'm guessing it was probably the debug information generators,
or mostly those.  Anyhow, I don't think y'all should be taking a decision I
made for the C front end under time and peer pressure (people were *really mad*
at me for leaving some of those bugs unfixed for several releases in a row) in
2004 as a permanent compiler-wide design constraint ten years later :)

(Note also bug 13801, and the discussion of its fix, here:
https://gcc.gnu.org/ml/gcc-patches/2004-08/msg00085.html -- we wound up having
to back down from the "not only is there only one DECL per assembly level
symbol, it only ever accumulates information" rule that I originally wanted,
due to C90 conformance problems.)

Reply via email to