public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34166] New: -fleading-underscore duplicate underscore in some template cases
@ 2007-11-20 20:04 shockenhull at niceberg dot com
2007-11-21 18:03 ` [Bug c++/34166] " shockenhull at niceberg dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: shockenhull at niceberg dot com @ 2007-11-20 20:04 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/34166] -fleading-underscore duplicate underscore in some template cases
2007-11-20 20:04 [Bug c++/34166] New: -fleading-underscore duplicate underscore in some template cases shockenhull at niceberg dot com
@ 2007-11-21 18:03 ` shockenhull at niceberg dot com
2007-11-23 20:21 ` shockenhull at niceberg dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: shockenhull at niceberg dot com @ 2007-11-21 18:03 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/34166] -fleading-underscore duplicate underscore in some template cases
2007-11-20 20:04 [Bug c++/34166] New: -fleading-underscore duplicate underscore in some template cases shockenhull at niceberg dot com
2007-11-21 18:03 ` [Bug c++/34166] " shockenhull at niceberg dot com
@ 2007-11-23 20:21 ` shockenhull at niceberg dot com
2007-11-28 22:23 ` shockenhull at niceberg dot com
2007-11-28 22:34 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: shockenhull at niceberg dot com @ 2007-11-23 20:21 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/34166] -fleading-underscore duplicate underscore in some template cases
2007-11-20 20:04 [Bug c++/34166] New: -fleading-underscore duplicate underscore in some template cases shockenhull at niceberg dot com
2007-11-21 18:03 ` [Bug c++/34166] " shockenhull at niceberg dot com
2007-11-23 20:21 ` shockenhull at niceberg dot com
@ 2007-11-28 22:23 ` shockenhull at niceberg dot com
2007-11-28 22:34 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: shockenhull at niceberg dot com @ 2007-11-28 22:23 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/34166] -fleading-underscore duplicate underscore in some template cases
2007-11-20 20:04 [Bug c++/34166] New: -fleading-underscore duplicate underscore in some template cases shockenhull at niceberg dot com
` (2 preceding siblings ...)
2007-11-28 22:23 ` shockenhull at niceberg dot com
@ 2007-11-28 22:34 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-28 22:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2007-11-28 22:34 -------
This is not a bug since you did not compile libstdc++ with
-fleading-underscore. There are some headers with extern template.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34166
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-28 22:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-20 20:04 [Bug c++/34166] New: -fleading-underscore duplicate underscore in some template cases shockenhull at niceberg dot com
2007-11-21 18:03 ` [Bug c++/34166] " shockenhull at niceberg dot com
2007-11-23 20:21 ` shockenhull at niceberg dot com
2007-11-28 22:23 ` shockenhull at niceberg dot com
2007-11-28 22:34 ` pinskia at gcc dot gnu dot org
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).