public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/22065] New: -fdump-tree-original causes static function to emitted with the same name
@ 2005-06-14 17:39 pinskia at gcc dot gnu dot org
  2005-06-17 10:25 ` [Bug c/22065] " belyshev at depni dot sinp dot msu dot ru
  0 siblings, 1 reply; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-14 17:39 UTC (permalink / raw)
  To: gcc-bugs

Combining the following C functions and using -fdump-tree-original causes the static function with 
the same name to emitted with the same name instead of with an unique number.
--- file1.c ---
static void f(){}
void g(){f();}
--- cut ---
--- file2.c ---
static void f(){}
void h(){f();}
--- cut ---

Compile this with "-combine -fdump-tree-original file1.c file2.c -c" and see that this fails to assemble.

Some analysis from Caroline:
If you call c_genericize with the flag for the dump turned on, it calls
DECL_ASSEMBLER_NAME (it ought to call DECL_NAME).  The problem
I saw was:  I was compiling a bunch of files at the same time  (a SPEC
benchmark).  Several of the C files called the same header file, which had
a tiny function defined inside it.  The function name *should* have gotten
a number appended to the end of it so that each occurrence of it in the
assembly file was unique.  However the premature call to DECL_ASSEMBLER_NAME
in c_genericize (when dump is turned on) meant the context was not
properly set at the time DECL_ASSEMBLER_NAME was called, which in
turn meant the uniquifying numbers were not appended to the function name,
which resulted in multiple functions with the same name in the .s file, which caused
the linker to complain vociferously.

I generated the testcase from her description of the bug.

-- 
           Summary: -fdump-tree-original causes static function to emitted
                    with the same name
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: ctice at apple dot com,gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22065


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <bug-22065-6528@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-22065-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-11-07 19:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-14 17:39 [Bug c/22065] New: -fdump-tree-original causes static function to emitted with the same name pinskia at gcc dot gnu dot org
2005-06-17 10:25 ` [Bug c/22065] " belyshev at depni dot sinp dot msu dot ru
     [not found] <bug-22065-6528@http.gcc.gnu.org/bugzilla/>
2005-10-16  3:48 ` pinskia at gcc dot gnu dot org
2005-10-16  3:50 ` pinskia at gcc dot gnu dot org
2005-10-16  4:27 ` pinskia at gcc dot gnu dot org
2005-10-16 16:18 ` pinskia at gcc dot gnu dot org
2005-10-16 16:45 ` pinskia at gcc dot gnu dot org
2005-10-16 17:01 ` pinskia at gcc dot gnu dot org
2005-10-16 18:52 ` pinskia at gcc dot gnu dot org
2005-10-23  0:04 ` pinskia at gcc dot gnu dot org
     [not found] <bug-22065-4@http.gcc.gnu.org/bugzilla/>
2011-11-07 19:32 ` belyshev at depni dot sinp.msu.ru

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).