[Bug c++/38828] g++ 4.3.2: -O2 without -fno-inline-small-functions makes some template instantiations disappear

ronan dot lehy at probayes dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 14 09:11:00 GMT 2009



------- Comment #6 from ronan dot lehy at probayes dot com  2009-01-14 09:11 -------
Thanks a lot for considering this report!

(In reply to comment #5)
> Also since it is not explicitly instatinated, the template does not need to be
> in the object file really.

I believe this is instantiated with Archive = boost_xml_iarchive by the
BOOST_EXPORT macro.

(In reply to comment #5)
> serialize with an empty body is a pure function so it will be can
> be optimized away without any effects.  I don't see the issue here really.

But this function (as instantiated with Archive = boost_xml_iarchive by
BOOST_EXPORT) can be called from other .o files. Actually, it is, and linking
the .o files together into a shared library then fails.

> Can you give a better example of why do you think this is wrong besides a nm
> testcase?

I could show you how mylib1.o and mylib2.o fail to link into libmylib.so, since
serialize<boost_xml_iarchive>(boost_xml_iarchive&, A&, unsigned int) is
referenced by mylib2.o, and should be defined in mylib1.o, but is not. Do you
want that ?


-- 


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



More information about the Gcc-bugs mailing list