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

2007-11-28 Thread shockenhull at niceberg dot com


--- Comment #3 from shockenhull at niceberg dot com  2007-11-28 22:23 
---
the problem is in the pre-compiled c++ library

work around:

using option -D_GLIBCXX_EXTERN_TEMPLATE=0 
disable pre-compiled templates in the c++ headers and force correct
instanciation when -fleading-underscore is used

thanks to Andrew Pinski for pointing to the "extern template" feature.

maybe overriding the platform's defaut underscore prefix should define
_GLIBCXX_EXTERN_TEMPLATE=0 if not overriden explicitly so the glitch wont come
up?


-- 


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



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

2007-11-23 Thread shockenhull at niceberg dot com


--- Comment #2 from shockenhull at niceberg dot com  2007-11-23 20:21 
---
this bug seem to be related to the fact that std::string's name mangling is
optimized by shortening it to a special encoding which might bypass the
underscore prefix option

is there an option to disable the special case encoding for std::string ?


-- 


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



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

2007-11-21 Thread shockenhull at niceberg dot com


--- Comment #1 from shockenhull at niceberg dot com  2007-11-21 18:02 
---
Created an attachment (id=14598)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14598&action=view)
.ii file that produce error


-- 


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



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

2007-11-20 Thread shockenhull at niceberg dot com
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 
#include 

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