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

            Bug ID: 94325
           Summary: [UBSAN] "invalid vptr" false positive for virtual
                    inheritance with -fno-sanitize-recover=all
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jaroslaw.melzer.gcc at gmail dot com
  Target Milestone: ---

Created attachment 48111
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48111&action=edit
reproducer code

See attached: ubsan-gcc.ii

Program ubsan-gcc compiled with options:
g++ -fsanitize=undefined -fno-sanitize-recover=all ubsan-gcc.ii

exits with following false positive:

ubsan-gcc.cpp:12:7: runtime error: member call on address 0x7ffcdd8c9800 which
does not point to an object of type 'DE'
0x7ffcdd8c9800: note: object has invalid vptr
 17 56 00 00  00 00 00 00 00 00 00 00  00 76 43 93 7b 4b c2 bf  30 71 eb 2f 17
56 00 00  e3 41 18 cc
              ^~~~~~~~~~~~~~~~~~~~~~~
              invalid vptr

May be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87095

This error doesn't manifest without -fno-sanitize-recover=all


gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.2.1-9ubuntu2'
--with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--with-target-system-zlib=auto --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)

Reply via email to