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

            Bug ID: 88684
           Summary: Please make SANITIZER_NON_UNIQUE_TYPEINFO a runtime
                    flag (or always true)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rafael at espindo dot la
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Even on ABIs that normally unique typeinfo names, it is easy to end up in
situations where that fails.

Consider a shared library implemented with

lib.hh:
struct foo {
    virtual ~foo(){}
};
struct bar : public foo {
    virtual void zed();
};

lib.cc:
#include "lib.hh"
void bar::zed() {}

and being used by the program (could be another library):

test.cc:
#include "lib.hh"
int main(int argc, char** argv) { bar t; }

if the program is compiled with -fvisibility=hidden, it will have a hidden
_ZTI3foo which isDerivedFromAtOffset will think doesn't match the _ZTI3foo in
the library.

The above test is a reduction of

#include <boost/test/unit_test.hpp>
int main(int argc, char **argv) {
    return 0;
}

compiled with -fvisibility=hidden, which complains that

/usr/include/boost/test/unit_test_log.hpp:112:23: runtime error: member call on
address 0x000006583060 which does not point to an object of type
'test_observer'

Reply via email to