brintos

brintos / llvm-project-archived public Read only

0
0
Text · 651 B · 037c8b3 Raw
18 lines · cpp
1// Check that we report new[] vs delete as alloc-dealloc-mismatch and not as2// new-delete-type-mismatch when -fsized-deallocation is enabled.3 4// RUN: %clangxx_asan -fno-sized-deallocation -g %s -o %t && %env_asan_opts=alloc_dealloc_mismatch=1 not %run %t 2>&1 | FileCheck %s5// RUN: %clangxx_asan -fsized-deallocation -g %s -o %t && %env_asan_opts=alloc_dealloc_mismatch=1 not %run %t 2>&1 | FileCheck %s6 7#include <stdlib.h>8 9static volatile char *x;10 11int main() {12  x = new char[10];13  delete x;14}15 16// CHECK: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x17// CHECK: is located 0 bytes inside of 10-byte region18