1 // RUN: %clangxx -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
3 // REQUIRES: stable-runtime
6 // FIXME: On Darwin, LSAn detects the leak, but does not invoke the death_callback.
7 // XFAIL: darwin && lsan
9 #include <sanitizer/common_interface_defs.h>
12 volatile char *zero
= 0;
15 fprintf(stderr
, "DEATH CALLBACK EXECUTED\n");
17 // CHECK: DEATH CALLBACK EXECUTED
22 __attribute__((noinline
))
23 void MaybeInit(int *uninitialized
) {
28 __attribute__((noinline
))
30 // Trigger lsan report. Two attempts in case the address of the first
31 // allocation remained on the stack.
36 int main(int argc
, char **argv
) {
38 __sanitizer_set_death_callback(Death
);
39 MaybeInit(&uninitialized
);
40 if (uninitialized
) // trigger msan report.
44 global
= sink
[0]; // use-after-free: trigger asan/tsan report.