]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/asan/TestCases/Linux/new_delete_mismatch.cc
New upstream version 1.19.0+dfsg1
[rustc.git] / src / compiler-rt / test / asan / TestCases / Linux / new_delete_mismatch.cc
CommitLineData
5bcae85e
SL
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
7cac9316
XL
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
5bcae85e
SL
6
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 0x