From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BDB8438618BD; Tue, 1 Sep 2020 09:05:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDB8438618BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598951114; bh=NYR+0ABE00t8oSJJ4a9dYEjPUXD4mNV2IBDbZPGUtCQ=; h=From:To:Subject:Date:From; b=wF7Xadx++wvJ6/2LwYhg8enxRZDiXUVbLkAtgfFTqgrxIqVRaiR+EukZq8ov9xASZ 2jTmWKSstEHOH+Y9GGU2ZOjEV23YAJN/2YyLkCGlGPlpexjKbGKJXa2nw81lOHbE/T RiuoVi1aDe6r9F7F4QGfPYXphWnS8RRS4NNpaYF4= From: "fakepaper56 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96880] New: undefined reference to `__dynamic_cast' when compiling with -fsanitize=vptr and -static Date: Tue, 01 Sep 2020 09:05:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 7.5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fakepaper56 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2020 09:05:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96880 Bug ID: 96880 Summary: undefined reference to `__dynamic_cast' when compiling with -fsanitize=3Dvptr and -static Product: gcc Version: 7.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fakepaper56 at gmail dot com Target Milestone: --- I compiled the following code with '-fsanitize=3Dvptr -static'.But I had er= ror message '-fsanitize=3Dvptr -static' struct A { virtual ~A() {}; }; int main() { A a; } Enviorment: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) Configured with: ../src/configure -v --with-pkgversion=3D'Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=3Dfile:///usr/share/doc/gcc-7/README.Bu= gs --enable-languages=3Dc,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=3D/u= sr --with-gcc-major-version-only --program-suffix=3D-7 --program-prefix=3Dx86_64-linux-gnu- --enable-shared --enable-linker-build-= id --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix --libdir=3D/usr/lib --enable-nls --enable-bootstrap --enable-clocale=3Dgnu --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --with-default-libstdcxx-abi=3Dnew --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=3Dauto --enable-multiarch --disable-werror --with-arch-32=3Di686 --with-abi=3Dm64 --with-multilib-list=3Dm32,m64,mx32 --enable-multilib --with-tune=3Dgeneric --enable-offload-targets=3Dnvptx-none --without-cuda-driver --enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_64-linu= x-gnu --target=3Dx86_64-linux-gnu Compiled option: g++ vptr.i -fsanitize=3Dvptr -static Output error: /usr/lib/gcc/x86_64-linux-gnu/7/libubsan.a(ubsan_type_hash_itanium.o): In function `isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long)': (.text+0x52): undefined reference to `__dynamic_cast' (.text+0x5e): undefined reference to `typeinfo for __cxxabiv1::__vmi_class_type_info' (.text+0x6b): undefined reference to `__dynamic_cast' /usr/lib/gcc/x86_64-linux-gnu/7/libubsan.a(ubsan_type_hash_itanium.o): In function `findBaseAtOffset(__cxxabiv1::__class_type_info const*, long)': (.text+0x151): undefined reference to `__dynamic_cast' (.text+0x15d): undefined reference to `typeinfo for __cxxabiv1::__vmi_class_type_info' (.text+0x16a): undefined reference to `__dynamic_cast' /usr/lib/gcc/x86_64-linux-gnu/7/libubsan.a(ubsan_type_hash_itanium.o): In function `__ubsan::checkDynamicType(void*, void*, unsigned long)': (.text+0x293): undefined reference to `__dynamic_cast' collect2: error: ld returned 1 exit status=