[Bug c++/34166] New: -fleading-underscore duplicate underscore in some template cases

shockenhull at niceberg dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 20 20:04:00 GMT 2007


we get duplicate underscore prefixes on std::string template function calls
generated when using -fleading-underscore

the .stabs entries are fine ("_ZNSs7reserveEm") but the generated assembler
code calls "__ZNSs7reserveEm" with two underscores instead
so the linker gives us a undefined symbol "__ZNSs7reserveEm" error

we tried with -O2, -O1, and -O0 and get the same result

other templates compile fine
------------------------------
Using built-in specs.
Target: i386-unknown-elf
Configured with: ../configure --with-mpfr-dir=../../mpfr-2.2.1/
--target=i386-unknown-elf --prefix=/home/shockenhull/bin/i386-unknown-elf
--enable-targets=all
Thread model: single
gcc version 4.1.1
Linux shockenhull 2.6.16.13-4-smp #1 SMP Wed May 3 04:53:23 UTC 2006 i686
athlon i386 GNU/Linux

-------------------------------------------

i386-unknown-elf-g++ -c -fleading-underscore -g -O0 -D__cpluscplus -D__CYGWIN__
-I../externals/include/w32api -D__cdecl= -Ddllimport= -DDECLSPEC_NORETURN= 
--save-temps -DTARGET_WIN32 -DTARGET_OS="WIN32" -DPRAY_WINDOWS_DOESNT_CRASH=1
-DTARGET_IA32 -DTARGET_CPU="IA32" -D__cdecl= -D__declspec= -Ddllimport=
-D__INSIDE_CYGWIN__ -Wno-pmf-conversions -I../ -I../../../
-I/home/shockenhull/projects/sqrlen/base  
-I/home/shockenhull/projects/sqrlen/base/win32  
-I/home/shockenhull/projects/sqrlen/base/ia32   -I../externals/include
-I../../../src -I/home/shockenhull/projects/sqrlen/drivers/video_out
-I/home/shockenhull/projects/sqrlen/drivers/video_out/win32_gl_hack
-I/home/shockenhull/projects/sqrlen/drivers/pc_misc/xml
-I/home/shockenhull/projects/sqrlen/drivers/pc_misc/ministring
-I/home/shockenhull/projects/sqrlen/drivers/fs 
-I/home/shockenhull/projects/sqrlen/drivers/fs/win32 -include windef.h  -o
pc_misc/xml/test.o
/home/shockenhull/projects/sqrlen/drivers/pc_misc/xml/test.cpp

-----------------------------------------------------------
#include <stdio.h>
#include <string>

void bob(void)
{
        std::string s;
        s = "biby";
        s.replace(1, 4, "ob");
        printf("%s\n", s.c_str());
}

-----------------------------------------------------------

I have the the test.ii file but it is 424KiB so I cannot post it here.
please email me for the file, I will email it back.


-- 
           Summary: -fleading-underscore duplicate underscore in some
                    template cases
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: shockenhull at niceberg dot com
 GCC build triplet: i386-linux-elf
  GCC host triplet: i386-linux-elf
GCC target triplet: i386-unknown-elf


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



More information about the Gcc-bugs mailing list