1 // RUN: %clangxx_asan -fsanitize-address-use-after-return=never -O %s -o %t && %run %t
5 #include <sanitizer/asan_interface.h>
7 __attribute__((noinline
))
10 fprintf(stderr
, "Throw: %p\n", &local
);
14 __attribute__((noinline
))
15 void ThrowAndCatch() {
20 fprintf(stderr
, "Catch: %p\n", &local
);
24 __attribute__((noinline
))
27 fprintf(stderr
, "Before: %p poisoned: %d\n", &x
,
28 __asan_address_is_poisoned(x
+ 32));
29 assert(__asan_address_is_poisoned(x
+ 32));
31 fprintf(stderr
, "After: %p poisoned: %d\n", &x
,
32 __asan_address_is_poisoned(x
+ 32));
33 assert(!__asan_address_is_poisoned(x
+ 32));
36 __attribute__((noinline
))
37 void TestThrowInline() {
39 fprintf(stderr
, "Before: %p poisoned: %d\n", &x
,
40 __asan_address_is_poisoned(x
+ 32));
41 assert(__asan_address_is_poisoned(x
+ 32));
45 fprintf(stderr
, "Catch\n");
47 fprintf(stderr
, "After: %p poisoned: %d\n", &x
,
48 __asan_address_is_poisoned(x
+ 32));
49 assert(!__asan_address_is_poisoned(x
+ 32));
52 int main(int argc
, char **argv
) {