[Bug libstdc++/85930] New: Misaligned reference created in shared_ptr_base.h with -fno-rtti

andrey.vihrov at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri May 25 20:25:00 GMT 2018


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

            Bug ID: 85930
           Summary: Misaligned reference created in shared_ptr_base.h with
                    -fno-rtti
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.vihrov at gmail dot com
  Target Milestone: ---

Compiling and running the following code:

    #include <memory>

    extern const char c = 42;

    int main()
    {
        std::make_shared<int>();
    }

with "g++ -fno-rtti -fsanitize=undefined test.cpp" gives

/usr/include/c++/8.1.0/bits/shared_ptr_base.h:520:54: runtime error: reference
binding to misaligned address 0x5625f607b75c for type 'const struct type_info',
which requires 8 byte alignment
0x5625f607b75c: note: pointer points here
  72 2e 68 00 00 00 00 00  01 1b 03 3b 34 02 00 00  45 00 00 00 00 dc ff ff  80
02 00 00 a0 dc ff ff
              ^ 

This was introduced in r247905, which fixed PR 80285.

g++ -v:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 8.1.0 (GCC)


More information about the Gcc-bugs mailing list