[Bug libstdc++/92927] Bootstrap failed with CXXFLAGS="-O0"

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 20 15:24:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92927

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
When the functions are not inline they are not instantiated by std::string at
-O0:

$ nm bad-stage1-src/c++11/string-inst.o | grep on_swap
0000000000000000 W _ZN9__gnu_cxx14__alloc_traitsISaIcEcE10_S_on_swapERS1_S3_
                 U _ZSt15__alloc_on_swapISaIcEEvRT_S2_

When the functions are inline (either explicitly with the 'inline' keyword or
implicitly with 'constexpr') they do get instantiated at -O0:

$ nm good-stage1-src/c++11/string-inst.o | grep on_swap
0000000000000000 W _ZN9__gnu_cxx14__alloc_traitsISaIcEcE10_S_on_swapERS1_S3_
0000000000000000 W _ZSt15__alloc_on_swapISaIcEEvRT_S2_
0000000000000000 W
_ZSt18__do_alloc_on_swapISaIcEEvRT_S2_St17integral_constantIbLb0EE

Because those functions aren't explicitly instantiated in
src/c++11/string-inst.o they are not present in libstdc++.so when it is
compiled with -O0.

Before r277342 those functions were always inline. I changed them to be always
constexpr, then in r277588 changed them to be constexpr for C++14, but I didn't
restore the 'inline' for C++11.

Fix incoming.


More information about the Gcc-bugs mailing list