From d86233428832a65ba5b19ff8621eb703c37397b5 Mon Sep 17 00:00:00 2001 From: Alex Shlyapnikov Date: Sat, 23 Dec 2017 00:30:51 +0000 Subject: [Sanitizers] Export aligned new/delete from runtimes. Summary: Export aligned new/delete to make dynamic runtimes work again. Remove all valid new/delete cases from ASan test, there's a test in common for that. Reviewers: eugenis Subscribers: srhines, kubamracek, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41548 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321394 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/asan/TestCases/Linux/aligned_delete_test.cc | 34 ++-------------------- .../TestCases/Linux/new_delete_test.cc | 6 ++-- 2 files changed, 6 insertions(+), 34 deletions(-) (limited to 'test') diff --git a/test/asan/TestCases/Linux/aligned_delete_test.cc b/test/asan/TestCases/Linux/aligned_delete_test.cc index 5b9455e56..9117198f9 100644 --- a/test/asan/TestCases/Linux/aligned_delete_test.cc +++ b/test/asan/TestCases/Linux/aligned_delete_test.cc @@ -6,12 +6,10 @@ // RUN: %env_asan_opts=new_delete_type_mismatch=1:halt_on_error=false:detect_leaks=false %run %t 2>&1 | FileCheck %s // RUN: %env_asan_opts=new_delete_type_mismatch=0 %run %t -// REQUIRES: asan-static-runtime - #include // Define all new/delete to do not depend on the version provided by the -// plaform. The implementation is provided by ASan anyway. +// platform. The implementation is provided by ASan anyway. namespace std { struct nothrow_t {}; @@ -57,34 +55,8 @@ struct alignas(1024) S1024_1024 { char a[1024]; }; int main(int argc, char **argv) { - fprintf(stderr, "Testing valid cases\n"); - - delete break_optimization(new S12); - operator delete(break_optimization(new S12), std::nothrow); - delete [] break_optimization(new S12[100]); - operator delete[](break_optimization(new S12[100]), std::nothrow); - - delete break_optimization(new S12_128); - operator delete(break_optimization(new S12_128), - std::align_val_t(alignof(S12_128))); - operator delete(break_optimization(new S12_128), - std::align_val_t(alignof(S12_128)), std::nothrow); - operator delete(break_optimization(new S12_128), sizeof(S12_128), - std::align_val_t(alignof(S12_128))); - - delete [] break_optimization(new S12_128[100]); - operator delete[](break_optimization(new S12_128[100]), - std::align_val_t(alignof(S12_128))); - operator delete[](break_optimization(new S12_128[100]), - std::align_val_t(alignof(S12_128)), std::nothrow); - operator delete[](break_optimization(new S12_128[100]), sizeof(S12_128[100]), - std::align_val_t(alignof(S12_128))); - - fprintf(stderr, "Done\n"); - // CHECK: Testing valid cases - // CHECK-NEXT: Done - - // Explicit mismatched calls. + // Check the mismatched calls only, all the valid cases are verified in + // test/sanitizer_common/TestCases/Linux/new_delete_test.cc. operator delete(break_optimization(new S12_128), std::nothrow); // CHECK: AddressSanitizer: new-delete-type-mismatch diff --git a/test/sanitizer_common/TestCases/Linux/new_delete_test.cc b/test/sanitizer_common/TestCases/Linux/new_delete_test.cc index f6644aa42..5e5346a08 100644 --- a/test/sanitizer_common/TestCases/Linux/new_delete_test.cc +++ b/test/sanitizer_common/TestCases/Linux/new_delete_test.cc @@ -1,8 +1,8 @@ // RUN: %clangxx -std=c++1z -faligned-allocation -O0 %s -o %t && %run %t // RUN: %clangxx -std=c++1z -faligned-allocation -fsized-deallocation -O0 %s -o %t && %run %t -// ubsan does not intercept new/delete, adnroid is to be fixed. -// UNSUPPORTED: ubsan,android +// ubsan does not intercept new/delete. +// UNSUPPORTED: ubsan // Check that all new/delete variants are defined and work with supported // sanitizers. Sanitizer-specific failure modes tests are supposed to go to @@ -11,7 +11,7 @@ #include // Define all new/delete to do not depend on the version provided by the -// plaform. The implementation is provided by the sanitizer anyway. +// platform. The implementation is provided by the sanitizer anyway. namespace std { struct nothrow_t {}; -- cgit v1.2.3