Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / compiler-rt / test / asan / TestCases / longjmp.cpp
blob66be9e32d0975766be64ceb62a5d9bdae4fae691
1 // RUN: %clangxx_asan -fsanitize-address-use-after-return=never -O %s -o %t && %run %t
3 #include <assert.h>
4 #include <setjmp.h>
5 #include <stdio.h>
6 #include <sanitizer/asan_interface.h>
8 static jmp_buf buf;
10 int main() {
11 char x[32];
12 fprintf(stderr, "\nTestLongJmp\n");
13 fprintf(stderr, "Before: %p poisoned: %d\n", &x,
14 __asan_address_is_poisoned(x + 32));
15 assert(__asan_address_is_poisoned(x + 32));
16 if (0 == setjmp(buf))
17 longjmp(buf, 1);
18 fprintf(stderr, "After: %p poisoned: %d\n", &x,
19 __asan_address_is_poisoned(x + 32));
20 assert(!__asan_address_is_poisoned(x + 32));