1*673dc3d4SNico Weber // Check that we report delete on a memory that belongs to a stack variable. 2*673dc3d4SNico Weber 3*673dc3d4SNico Weber // RUN: %clangxx_asan -g %s -o %t && %env_asan_opts=alloc_dealloc_mismatch=1 not %run %t 2>&1 | FileCheck %s 4*673dc3d4SNico Weber 5*673dc3d4SNico Weber #include <stdlib.h> 6*673dc3d4SNico Weber 7*673dc3d4SNico Weber static volatile char *x; 8*673dc3d4SNico Weber main()9*673dc3d4SNico Weberint main() { 10*673dc3d4SNico Weber char a[10]; 11*673dc3d4SNico Weber x = &a[0]; 12*673dc3d4SNico Weber delete x; 13*673dc3d4SNico Weber } 14*673dc3d4SNico Weber 15*673dc3d4SNico Weber // CHECK: AddressSanitizer: attempting free on address which was not malloc()-ed 16*673dc3d4SNico Weber // CHECK: is located in stack of thread T0 at offset 17*673dc3d4SNico Weber // CHECK: 'a'{{.*}} <== Memory access at offset {{16|32}} is inside this variable 18