• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Check that we report new[] vs delete as alloc-dealloc-mismatch and not as
2 // new-delete-type-mismatch when -fsized-deallocation is enabled.
3 
4 // RUN: %clangxx_asan -g %s -o %t && %env_asan_opts=alloc_dealloc_mismatch=1 not %run %t 2>&1 | FileCheck %s
5 // RUN: %clangxx_asan -fsized-deallocation -g %s -o %t && %env_asan_opts=alloc_dealloc_mismatch=1 not %run %t 2>&1 | FileCheck %s
6 
7 #include <stdlib.h>
8 
9 static volatile char *x;
10 
main()11 int main() {
12   x = new char[10];
13   delete x;
14 }
15 
16 // CHECK: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x
17 // CHECK: is located 0 bytes inside of 10-byte region
18