c++/2473: Implicitely instantiated template function not marked weak

wolfgang.bangerth@iwr.uni-heidelberg.de wolfgang.bangerth@iwr.uni-heidelberg.de
Tue Apr 3 02:56:00 GMT 2001


>Number:         2473
>Category:       c++
>Synopsis:       Implicitely instantiated template function not marked weak
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 03 02:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
deal.II/base> gcc -v
Reading specs from /home/people/wolf/Config/gcc-ss-sun/lib/gcc-lib/sparc-sun-solaris2.7/3.0/specs
Configured with: ../gcc/configure --prefix=/home/people/wolf/Config/gcc-ss-sun --with-gnu-as --with-gnu-ld --with-ld=/usr/local/bin/ld --with-as=/usr/local/bin/as
gcc version 3.0 20010401 (prerelease)
deal.II/base> uname -a
SunOS eris 5.7 Generic_106541-10 sun4u sparc SUNW,Ultra-2
>Description:
The following problem is causing us many link failures since
implicitely instantiated templates are not marked weak and
thus result in multiply defined symbols at link time. Note that
this only happens with -O1 and higher. Sorry that I couldn't
strip it down further than those 40 lines, but touching any 
line seems to make the bug go away. In any case, it's better
the initial ~30000 lines...

Regards
  Wolfgang
>How-To-Repeat:
deal.II/base> c++ -O1 -c t.cc ; nm t.o | c++filt | grep std::min
0000000000000028 T int std::min<int>(int, int)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="t.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="t.cc"

bmFtZXNwYWNlIHN0ZAp7CiAgdGVtcGxhdGUgPGNsYXNzIFQ+CiAgaW5saW5lIFQgbWluKFQgYSwg
VCBiKSB7IGlmIChiIDwgYSkgcmV0dXJuIGI7IHJldHVybiBhOyB9CgogIHRlbXBsYXRlIDxjbGFz
cyBUPiBzdHJ1Y3QgYWxsb2Mg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ICZrZXkpeyBrZXkg
PT0ga2V5OyB9Cn0K



More information about the Gcc-bugs mailing list