public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?)
@ 2005-10-15 20:08 maarten dot keijzer at gmail dot com
2005-10-15 20:15 ` [Bug c++/24389] " pinskia at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: maarten dot keijzer at gmail dot com @ 2005-10-15 20:08 UTC (permalink / raw)
To: gcc-bugs
Creating two files:
==== t1.cpp ===
#include <tr1/unordered_map>
std::tr1::unordered_map<int,int> map1;
int main() {}
==== t2.cpp ====
#include <tr1/unordered_map>
std::tr1::unordered_map<int, float> map;
int t2(int i) { return 0; }
=============
compiling them with
g++ -Wall t1.cpp t2.cpp
leads to compiler output:
t2.o:(.bss+0x20): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_10'
t1.o:(.bss+0x20): first defined here
t2.o:(.bss+0x21): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_9'
t1.o:(.bss+0x21): first defined here
t2.o:(.bss+0x22): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_8'
t1.o:(.bss+0x22): first defined here
t2.o:(.bss+0x23): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_7'
t1.o:(.bss+0x23): first defined here
t2.o:(.bss+0x24): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_6'
t1.o:(.bss+0x24): first defined here
t2.o:(.bss+0x25): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_5'
t1.o:(.bss+0x25): first defined here
t2.o:(.bss+0x26): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_4'
t1.o:(.bss+0x26): first defined here
t2.o:(.bss+0x27): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_3'
t1.o:(.bss+0x27): first defined here
t2.o:(.bss+0x28): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_2'
t1.o:(.bss+0x28): first defined here
t2.o:(.bss+0x29): multiple definition of `std::tr1::placeholders::(anonymous
namespace)::_1'
t1.o:(.bss+0x29): first defined here
t2.o:(.bss+0x2a): multiple definition of `std::tr1::(anonymous
namespace)::ignore'
t1.o:(.bss+0x2a): first defined here
t2.o:(.data+0x0): multiple definition of `_ZN8Internal1XIXT_EE8n_primesE'
t1.o:(.data+0x0): first defined here
==========
Thus preventing use of two unordered_map's in a single application.
g++ -v:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 (Debian 4.0.2-2)
--
Summary: tr1::unordered_map duplicate symbols (not extern?)
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: maarten dot keijzer at gmail dot com
GCC host triplet: Linux version 2.6.10
GCC target triplet: g++ 4.0.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] tr1::unordered_map duplicate symbols (not extern?)
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
@ 2005-10-15 20:15 ` pinskia at gcc dot gnu dot org
2005-10-15 20:21 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-15 20:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2005-10-15 20:15 -------
Hmm, there are two problems here, unless _ZN8Internal1XIXT_EE8n_primesE is what
is really broken in libstdc++'s headers.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] tr1::unordered_map duplicate symbols (not extern?)
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
2005-10-15 20:15 ` [Bug c++/24389] " pinskia at gcc dot gnu dot org
@ 2005-10-15 20:21 ` pinskia at gcc dot gnu dot org
2005-10-15 20:28 ` pcarlini at suse dot de
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-15 20:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2005-10-15 20:21 -------
Hmm
template<int dummy>
struct X
{
static const int n_primes = 256;
static const unsigned long primes[n_primes + 1];
};
template<int dummy>
const int X<dummy>::n_primes;
template<int dummy>
const unsigned long X<dummy>::primes[n_primes + 1] =
{ 0 };
and then use X<0>::primes in a function.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] tr1::unordered_map duplicate symbols (not extern?)
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
2005-10-15 20:15 ` [Bug c++/24389] " pinskia at gcc dot gnu dot org
2005-10-15 20:21 ` pinskia at gcc dot gnu dot org
@ 2005-10-15 20:28 ` pcarlini at suse dot de
2005-10-15 20:32 ` [Bug c++/24389] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-10-15 20:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pcarlini at suse dot de 2005-10-15 20:28 -------
Note that I cannot reproduce with 4.0.0 and 4.0.1. I'm wondering whether is
even
more fallout from that static patch :( ... CC-ing Mark
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmitchel at gcc dot gnu dot
| |org, pcarlini at suse dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] [4.0/4.1 Regression] tr1::unordered_map duplicate symbols (not extern?)
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
` (2 preceding siblings ...)
2005-10-15 20:28 ` pcarlini at suse dot de
@ 2005-10-15 20:32 ` pinskia at gcc dot gnu dot org
2005-10-15 20:42 ` [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-15 20:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2005-10-15 20:32 -------
(In reply to comment #3)
> Note that I cannot reproduce with 4.0.0 and 4.0.1. I'm wondering whether is
> even
> more fallout from that static patch :( ... CC-ing Mark
It looks like it.
file1.c:
template<int dummy>
struct X
{
static const int n_primes = 256;
static const unsigned long primes[n_primes + 1];
};
template<int dummy>
const int X<dummy>::n_primes;
template<int dummy>
const unsigned long X<dummy>::primes[n_primes + 1] =
{ 0 };
const unsigned long *f(void){return &X<0>::primes[0];}
------------------------------
file2.c:
template<int dummy>
struct X
{
static const int n_primes = 256;
static const unsigned long primes[n_primes + 1];
};
template<int dummy>
const int X<dummy>::n_primes;
template<int dummy>
const unsigned long X<dummy>::primes[n_primes + 1] =
{ 0 };
const unsigned long *f1(void){return &X<0>::primes[0];}
int main(){}
-------
Compile and link, this fails.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2005-10-15 20:32:13
date| |
Summary|tr1::unordered_map duplicate|[4.0/4.1 Regression]
|symbols (not extern?) |tr1::unordered_map duplicate
| |symbols (not extern?)
Target Milestone|--- |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
` (3 preceding siblings ...)
2005-10-15 20:32 ` [Bug c++/24389] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-10-15 20:42 ` pinskia at gcc dot gnu dot org
2005-10-15 20:45 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-15 20:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2005-10-15 20:42 -------
The problem is that the variable X<0>:: primes is not being marked as weak
which causes the rest to fail also because we are using that name for the first
non-weak global symbol to name anonymous namespace.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.0/4.1 Regression] |[4.0/4.1 Regression]
|tr1::unordered_map duplicate|template variable not
|symbols (not extern?) |getting marked as weak
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
` (4 preceding siblings ...)
2005-10-15 20:42 ` [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak pinskia at gcc dot gnu dot org
@ 2005-10-15 20:45 ` pinskia at gcc dot gnu dot org
2005-10-16 20:19 ` mmitchel at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-15 20:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2005-10-15 20:45 -------
*** Bug 24390 has been marked as a duplicate of this bug. ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
` (5 preceding siblings ...)
2005-10-15 20:45 ` pinskia at gcc dot gnu dot org
@ 2005-10-16 20:19 ` mmitchel at gcc dot gnu dot org
2005-10-16 23:16 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-16 20:19 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mark at codesourcery dot com
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
` (6 preceding siblings ...)
2005-10-16 20:19 ` mmitchel at gcc dot gnu dot org
@ 2005-10-16 23:16 ` cvs-commit at gcc dot gnu dot org
2005-10-16 23:18 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-10-16 23:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from cvs-commit at gcc dot gnu dot org 2005-10-16 23:16 -------
Subject: Bug 24389
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: mmitchel@gcc.gnu.org 2005-10-16 23:16:28
Modified files:
gcc/cp : decl2.c init.c pt.c
Added files:
gcc/testsuite/g++.dg/template: static21.C static21-a.cc
Log message:
PR c++/24389
* decl2.c (mark_used): Use uses_template_parms instead of
dependent_type_p.
* init.c (constant_value_1): Handle uninstantiated templates
specially.
* pt.c (instantiate_decl): Add sanity check.
PR c++/24389
* g++.dg/template/static21.C: New test.
* g++.dg/template/static21-a.cc: Likewise.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static21.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static21-a.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.803&r2=1.804
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.432&r2=1.433
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1048&r2=1.1049
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
` (7 preceding siblings ...)
2005-10-16 23:16 ` cvs-commit at gcc dot gnu dot org
@ 2005-10-16 23:18 ` cvs-commit at gcc dot gnu dot org
2005-10-16 23:19 ` cvs-commit at gcc dot gnu dot org
2005-10-16 23:19 ` mmitchel at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-10-16 23:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from cvs-commit at gcc dot gnu dot org 2005-10-16 23:17 -------
Subject: Bug 24389
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: mmitchel@gcc.gnu.org 2005-10-16 23:17:53
Modified files:
gcc/cp : ChangeLog
gcc/testsuite : ChangeLog
Log message:
PR c++/24389
* decl2.c (mark_used): Use uses_template_parms instead of
dependent_type_p.
* init.c (constant_value_1): Handle uninstantiated templates
specially.
* pt.c (instantiate_decl): Add sanity check.
PR c++/24389
* g++.dg/template/static21.C: New test.
* g++.dg/template/static21-a.cc: Likewise.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4939&r2=1.4940
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6200&r2=1.6201
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
` (8 preceding siblings ...)
2005-10-16 23:18 ` cvs-commit at gcc dot gnu dot org
@ 2005-10-16 23:19 ` cvs-commit at gcc dot gnu dot org
2005-10-16 23:19 ` mmitchel at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-10-16 23:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from cvs-commit at gcc dot gnu dot org 2005-10-16 23:19 -------
Subject: Bug 24389
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: mmitchel@gcc.gnu.org 2005-10-16 23:19:00
Modified files:
gcc/cp : decl2.c init.c pt.c ChangeLog
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/template: static21.C static21-a.cc
Log message:
PR c++/24389
* decl2.c (mark_used): Use uses_template_parms instead of
dependent_type_p.
* init.c (constant_value_1): Handle uninstantiated templates
specially.
* pt.c (instantiate_decl): Add sanity check.
PR c++/24389
* g++.dg/template/static21.C: New test.
* g++.dg/template/static21-a.cc: Likewise.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static21.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static21-a.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.770.2.10&r2=1.770.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.412.2.11&r2=1.412.2.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.978.2.32&r2=1.978.2.33
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.137&r2=1.4648.2.138
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.460&r2=1.5084.2.461
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
` (9 preceding siblings ...)
2005-10-16 23:19 ` cvs-commit at gcc dot gnu dot org
@ 2005-10-16 23:19 ` mmitchel at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-16 23:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from mmitchel at gcc dot gnu dot org 2005-10-16 23:19 -------
Fixed in 4.0.3.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24389
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-10-16 23:19 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-15 20:08 [Bug c++/24389] New: tr1::unordered_map duplicate symbols (not extern?) maarten dot keijzer at gmail dot com
2005-10-15 20:15 ` [Bug c++/24389] " pinskia at gcc dot gnu dot org
2005-10-15 20:21 ` pinskia at gcc dot gnu dot org
2005-10-15 20:28 ` pcarlini at suse dot de
2005-10-15 20:32 ` [Bug c++/24389] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-10-15 20:42 ` [Bug c++/24389] [4.0/4.1 Regression] template variable not getting marked as weak pinskia at gcc dot gnu dot org
2005-10-15 20:45 ` pinskia at gcc dot gnu dot org
2005-10-16 20:19 ` mmitchel at gcc dot gnu dot org
2005-10-16 23:16 ` cvs-commit at gcc dot gnu dot org
2005-10-16 23:18 ` cvs-commit at gcc dot gnu dot org
2005-10-16 23:19 ` cvs-commit at gcc dot gnu dot org
2005-10-16 23:19 ` mmitchel 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).