Home | History | Annotate | Download | only in Linux
      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 |& FileCheck %s
      5 // RUN: %clangxx_asan -fsized-deallocation -g %s -o %t && %env_asan_opts=alloc_dealloc_mismatch=1 not %run %t |& FileCheck %s
      6 
      7 #include <stdlib.h>
      8 
      9 static volatile char *x;
     10 
     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