This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/38828] g++ 4.3.2: -O2 without -fno-inline-small-functions makes some template instantiations disappear
- From: "bangerth at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2009 15:37:11 -0000
- Subject: [Bug c++/38828] g++ 4.3.2: -O2 without -fno-inline-small-functions makes some template instantiations disappear
- References: <bug-38828-17180@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from bangerth at gmail dot com 2009-01-30 15:37 -------
(In reply to comment #9)
> Following the twisted maze that is BOOST_CLASS_EXPORT() leads me to think that
> it is (very) roughly equivalent to this:
>
> void dummy(boost::archive::xml_iarchive & ar, A & a, B & b) {
> boost::serialization::serialize(ar, a, 0);
> boost::serialization::serialize(ar, b, 0);
> }
>
> Indeed, replacing my BOOST_CLASS_EXPORT() calls with this, I get the same
> effect ("disappearing" symbols with -O2).
>
> At this point, my question is: is triggering template instantiations in this
> way supposed to be equivalent to explicit instantiations (as in comment #8)
> with respect to symbols exposed to the outside? If the answer is no, thank you
> very much for your help and sorry for the trouble.
The answer is no. The code requires the *implicit* instantiation of some code
but the compiler only needs to instantiate whatever it needs and is free
to eliminate what it doesn't. In fact, there is no guarantee that any code
visible outside this one object file is generated at all.
W.
--
bangerth at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at gmail dot com
Status|WAITING |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38828