[Bug c/22065] New: -fdump-tree-original causes static function to emitted with the same name
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Jun 14 17:39:00 GMT 2005
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
More information about the Gcc-bugs
mailing list