[Bug libstdc++/51333] [7/8 Regression] cxxabi.h incompatible with -fkeep-inline-functions at link time
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 2 11:10:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51333
--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Mon Sep 2 11:10:00 2019
New Revision: 275309
URL: https://gcc.gnu.org/viewcvs?rev=275309&root=gcc&view=rev
Log:
PR libstdc++/51333 Define recursive_init_error constructor non-inline
The recursive_init_error class is defined in a header, with an inline
constructor, but the definition of the vtable and destructor are not
exported from the shared library. With -fkeep-inline-functions the
constructor gets emitted in user code, and requires the (non-exported)
vtable. This fails to link.
As far as I can tell, the recursive_init_error class definition was
moved into <cxxabi.h> so it could be documented with Doxygen, not for
any technical reason. But now it's there (and documented), somebody
could be relying on it, by catching that type and possibly performing
derived-to-base conversions to the std::exception base class. So the
conservative fix is to leave the class definition in the header but make
the constructor non-inline. This still allows the type to be caught and
still defines its base class.
Backport from mainline
2019-07-29 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/51333
* libsupc++/cxxabi.h (__gnu_cxx::recursive_init_error): Do not define
constructor inline.
* libsupc++/guard_error.cc (__gnu_cxx::recursive_init_error): Define
constructor.
* testsuite/18_support/51333.cc: New test.
Added:
branches/gcc-7-branch/libstdc++-v3/testsuite/18_support/51333.cc
Modified:
branches/gcc-7-branch/libstdc++-v3/ChangeLog
branches/gcc-7-branch/libstdc++-v3/libsupc++/cxxabi.h
branches/gcc-7-branch/libstdc++-v3/libsupc++/guard_error.cc
More information about the Gcc-bugs
mailing list