From owner-svn-src-vendor@freebsd.org Thu Dec 28 21:23:16 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06DF6E81286; Thu, 28 Dec 2017 21:23:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41A596C009; Thu, 28 Dec 2017 21:23:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBSLNC0Q024346; Thu, 28 Dec 2017 21:23:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBSLNCeU024342; Thu, 28 Dec 2017 21:23:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712282123.vBSLNCeU024342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 28 Dec 2017 21:23:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r327304 - in vendor/compiler-rt/dist: lib/builtins lib/ubsan lib/xray/tests/unit test/ubsan/TestCases/TypeCheck X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/compiler-rt/dist: lib/builtins lib/ubsan lib/xray/tests/unit test/ubsan/TestCases/TypeCheck X-SVN-Commit-Revision: 327304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Dec 2017 21:23:16 -0000 Author: dim Date: Thu Dec 28 21:23:12 2017 New Revision: 327304 URL: https://svnweb.freebsd.org/changeset/base/327304 Log: Vendor import of compiler-rt trunk r321530: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321530 Modified: vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc vendor/compiler-rt/dist/lib/xray/tests/unit/fdr_logging_test.cc vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/vptr.cpp Modified: vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt Thu Dec 28 21:23:09 2017 (r327303) +++ vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt Thu Dec 28 21:23:12 2017 (r327304) @@ -232,8 +232,6 @@ set(x86_ARCH_SOURCES if (NOT MSVC) set(x86_64_SOURCES - x86_64/chkstk.S - x86_64/chkstk2.S x86_64/floatdidf.c x86_64/floatdisf.c x86_64/floatdixf.c @@ -253,8 +251,6 @@ if (NOT MSVC) set(i386_SOURCES i386/ashldi3.S i386/ashrdi3.S - i386/chkstk.S - i386/chkstk2.S i386/divdi3.S i386/floatdidf.S i386/floatdisf.S Modified: vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc ============================================================================== --- vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc Thu Dec 28 21:23:09 2017 (r327303) +++ vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc Thu Dec 28 21:23:12 2017 (r327304) @@ -38,7 +38,8 @@ bool ignoreReport(SourceLocation SLoc, ReportOptions O const char *TypeCheckKinds[] = { "load of", "store to", "reference binding to", "member access within", "member call on", "constructor call on", "downcast of", "downcast of", - "upcast of", "cast to virtual base of", "_Nonnull binding to"}; + "upcast of", "cast to virtual base of", "_Nonnull binding to", + "dynamic operation on"}; } static void handleTypeMismatchImpl(TypeMismatchData *Data, ValueHandle Pointer, Modified: vendor/compiler-rt/dist/lib/xray/tests/unit/fdr_logging_test.cc ============================================================================== --- vendor/compiler-rt/dist/lib/xray/tests/unit/fdr_logging_test.cc Thu Dec 28 21:23:09 2017 (r327303) +++ vendor/compiler-rt/dist/lib/xray/tests/unit/fdr_logging_test.cc Thu Dec 28 21:23:12 2017 (r327304) @@ -13,6 +13,7 @@ #include "xray_fdr_logging.h" #include "gtest/gtest.h" +#include #include #include #include Modified: vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/vptr.cpp ============================================================================== --- vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/vptr.cpp Thu Dec 28 21:23:09 2017 (r327303) +++ vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/vptr.cpp Thu Dec 28 21:23:12 2017 (r327304) @@ -1,41 +1,53 @@ -// RUN: %clangxx -frtti -fsanitize=null,vptr -fno-sanitize-recover=null,vptr -g %s -O3 -o %t -mllvm -enable-tail-merge=false -// RUN: %run %t rT && %run %t mT && %run %t fT && %run %t cT -// RUN: %run %t rU && %run %t mU && %run %t fU && %run %t cU -// RUN: %run %t rS && %run %t rV && %run %t oV -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t mS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cS 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t mV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cV 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t oU 2>&1 | FileCheck %s --check-prefix=CHECK-OFFSET --check-prefix=CHECK-%os-OFFSET --strict-whitespace -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace -// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace -// RUN: not %run %t nN 2>&1 | FileCheck %s --check-prefix=CHECK-NULL-MEMFUN --strict-whitespace +// RUN: %clangxx -frtti -fsanitize=null,vptr -g %s -O3 -o %t -mllvm -enable-tail-merge=false +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rT +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t mT +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t fT +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t cT +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rU +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t mU +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t fU +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t cU +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rS +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rV +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t oV +// RUN: %env_ubsan_opts=halt_on_error=1 %run %t zN +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t mS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t fS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t cS 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t mV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t fV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t cV 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t oU 2>&1 | FileCheck %s --check-prefix=CHECK-OFFSET --check-prefix=CHECK-%os-OFFSET --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace +// RUN: %env_ubsan_opts=halt_on_error=1 not %run %t nN 2>&1 | FileCheck %s --check-prefix=CHECK-NULL-MEMFUN --strict-whitespace +// RUN: %env_ubsan_opts=print_stacktrace=1 %run %t dT 2>&1 | FileCheck %s --check-prefix=CHECK-DYNAMIC --check-prefix=CHECK-%os-DYNAMIC --strict-whitespace // RUN: (echo "vptr_check:S"; echo "vptr_check:T"; echo "vptr_check:U") > %t.supp -// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t mS -// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t fS -// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t cS -// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t mV -// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t fV -// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t cV -// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t oU +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t mS +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t fS +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t cS +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t mV +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t fV +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t cV +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t oU +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t dT // RUN: echo "vptr_check:S" > %t.loc-supp -// RUN: %env_ubsan_opts=suppressions='"%t.loc-supp"' not %run %t x- 2>&1 | FileCheck %s --check-prefix=CHECK-LOC-SUPPRESS +// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.loc-supp"' not %run %t x- 2>&1 | FileCheck %s --check-prefix=CHECK-LOC-SUPPRESS // REQUIRES: stable-runtime, cxxabi // UNSUPPORTED: win32 // Suppressions file not pushed to the device. // UNSUPPORTED: android #include +#include #include #include struct S { S() : a(0) {} - ~S() {} + ~S(); int a; int f() { return 0; } virtual int v() { return 0; } @@ -52,13 +64,23 @@ struct U : S, T { virtual int v() { return 2; } }; struct V : S {}; -// Make p global so that lsan does not complain. +namespace { + struct W {}; +} + T *p = 0; +bool dtorCheck = false; + volatile void *sink1, *sink2; int access_p(T *p, char type); +S::~S() { + if (dtorCheck) + access_p(p, '~'); +} + int main(int argc, char **argv) { assert(argc > 1); fprintf(stderr, "Test case: %s\n", argv[1]); @@ -180,6 +202,51 @@ int access_p(T *p, char type) { case 'n': // CHECK-NULL-MEMFUN: vptr.cpp:[[@LINE+1]]:15: runtime error: member call on null pointer of type 'T' return p->g(); + + case 'd': + dtorCheck = true; + delete p; + dtorCheck = false; + return 0; + case '~': + // CHECK-DYNAMIC: vptr.cpp:[[@LINE+6]]:11: runtime error: dynamic operation on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T' + // CHECK-DYNAMIC-NEXT: [[PTR]]: note: object is of type 'S' + // CHECK-DYNAMIC-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }} + // CHECK-DYNAMIC-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}} + // CHECK-DYNAMIC-NEXT: {{^ vptr for}} 'S' + // CHECK-Linux-DYNAMIC: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]] + (void)dynamic_cast(p); + // CHECK-DYNAMIC: vptr.cpp:[[@LINE+6]]:11: runtime error: dynamic operation on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T' + // CHECK-DYNAMIC-NEXT: [[PTR]]: note: object is of type 'S' + // CHECK-DYNAMIC-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }} + // CHECK-DYNAMIC-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}} + // CHECK-DYNAMIC-NEXT: {{^ vptr for}} 'S' + // CHECK-Linux-DYNAMIC: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]] + (void)dynamic_cast(p); + try { + // CHECK-DYNAMIC: vptr.cpp:[[@LINE+6]]:13: runtime error: dynamic operation on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T' + // CHECK-DYNAMIC-NEXT: [[PTR]]: note: object is of type 'S' + // CHECK-DYNAMIC-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }} + // CHECK-DYNAMIC-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}} + // CHECK-DYNAMIC-NEXT: {{^ vptr for}} 'S' + // CHECK-Linux-DYNAMIC: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]] + (void)dynamic_cast(*p); + } catch (std::bad_cast &) {} + // CHECK-DYNAMIC: vptr.cpp:[[@LINE+6]]:18: runtime error: dynamic operation on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T' + // CHECK-DYNAMIC-NEXT: [[PTR]]: note: object is of type 'S' + // CHECK-DYNAMIC-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }} + // CHECK-DYNAMIC-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}} + // CHECK-DYNAMIC-NEXT: {{^ vptr for}} 'S' + // CHECK-Linux-DYNAMIC: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]] + (void)typeid(*p); + return 0; + + case 'z': + (void)dynamic_cast(p); + try { + (void)typeid(*p); + } catch (std::bad_typeid &) {} + return 0; } return 0; }