diff options
Diffstat (limited to 'test/asan/TestCases/Linux/new_delete_mismatch.cc')
-rw-r--r-- | test/asan/TestCases/Linux/new_delete_mismatch.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/asan/TestCases/Linux/new_delete_mismatch.cc b/test/asan/TestCases/Linux/new_delete_mismatch.cc new file mode 100644 index 000000000000..1cfc0ef05312 --- /dev/null +++ b/test/asan/TestCases/Linux/new_delete_mismatch.cc @@ -0,0 +1,16 @@ +// Check that we report new[] vs delete as alloc-dealloc-mismatch and not as +// new-delete-type-mismatch when -fsized-deallocation is enabled. + +// RUN: %clangxx_asan -g %s -o %t && not %run %t |& FileCheck %s +// RUN: %clangxx_asan -fsized-deallocation -g %s -o %t && not %run %t |& FileCheck %s + +#include <stdlib.h> + +static volatile char *x; + +int main() { + x = new char[10]; + delete x; +} + +// CHECK: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x |