Bug 14065 - [tree-ssa] [unit-at-a-time] generates duplicate definition of invisible symbol forward declared
Summary: [tree-ssa] [unit-at-a-time] generates duplicate definition of invisible symbo...
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: tree-ssa
: P1 normal
Target Milestone: tree-ssa
Assignee: Zack Weinberg
Keywords: wrong-code
: 14036 (view as bug list)
Depends on:
Reported: 2004-02-07 19:12 UTC by Fariborz Jahanian
Modified: 2004-10-30 21:09 UTC (History)
4 users (show)

See Also:
Host: powerpc-apple-darwin7.0.0
Target: powerpc-apple-darwin7.0.0
Known to work: 4.0.0
Known to fail: tree-ssa
Last reconfirmed: 2004-03-07 09:32:18


Note You need to log in before you can comment on or make changes to this bug.
Description Fariborz Jahanian 2004-02-07 19:12:59 UTC
This bug was also uncovered building gap of the spec benchmark with tree-ssa. In the
following trivial test case, tree-ssa gcc produces two definition of the locally declaraed extern
which is later defined. Compile with -O2.

/* Bug in tree-ssa, tested on Apple, darwin, ppc. Compile with O2:

mygcct5o -O2 prxxx.c
/var/tmp//ccZZXOy5.s:8:FATAL:Symbol _CPN already defined.


void collect()
    extern long         CPN;
long         CPN=1;
Comment 1 Andrew Pinski 2004-02-07 19:17:34 UTC
Comment 2 Andrew Pinski 2004-02-07 19:23:51 UTC
Okay some analysis of the bug.  When in not unit-at-a-time mode, the symbol CPN is not put in the 
function scope while with it is.
Comment 3 Diego Novillo 2004-03-02 18:31:03 UTC
I've looked at it briefly.  Found that merge_decls was doing something odd, but
Zack mentioned on IRC that the fix implies changing a few data structures around.
Comment 4 Andrew Pinski 2004-03-10 16:54:44 UTC
*** Bug 14036 has been marked as a duplicate of this bug. ***
Comment 5 Andrew Pinski 2004-03-10 16:55:26 UTC
The problem is that when converting from generic to gimple, the variable goes from 
extern to static for some reason.
Comment 6 Andrew Pinski 2004-03-27 20:34:20 UTC
This was fixed by Zack's rewrite of c-decl.c so closing.