https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65057
Bug ID: 65057 Summary: Broken shared library if created with -fuse-ld=gold -shared -Wl,--dynamic-list Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: manisandro at gmail dot com Created attachment 34752 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34752&action=edit testcase What follows is with gcc-5.0.0-0.10.fc22.x86_64 (Fedora rawhide). See test case attached, build and run with the provided build.sh script. Overview: - A base class in a shared library (base.h, base.cpp) - The shared library is linked with -fuse-ld=gold -shared -Wl,--dynamic-list, the contents of the actual list provided to --dynamic-list does not seem to matter (in the provided testcase, the name of the symbol is made up). - A derived class in an application linking with the library (derived.h, derived.cpp) - Some random class which uses the derived class Problem: - The assertion at derived.h:25 fails => Derived::Derived calls Base::Base passing a DerivedPrivate instance to the base class, then Derived::Derived calls Base::init, which sets Base::self to the instance pointer this and calls DerivedPrivate::foo on the passed DerivedPrivate instance, which tests that Base::self is not null. This incorrectly fails. Background: This is causing Qt5 applications to crash in various ways.