diff options
Diffstat (limited to 'lib/tsan/lit_tests/longjmp.cc')
-rw-r--r-- | lib/tsan/lit_tests/longjmp.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/tsan/lit_tests/longjmp.cc b/lib/tsan/lit_tests/longjmp.cc new file mode 100644 index 0000000000000..d9ca4ca5e6e9d --- /dev/null +++ b/lib/tsan/lit_tests/longjmp.cc @@ -0,0 +1,22 @@ +// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s +#include <stdio.h> +#include <stdlib.h> +#include <setjmp.h> + +int foo(jmp_buf env) { + longjmp(env, 42); +} + +int main() { + jmp_buf env; + if (setjmp(env) == 42) { + printf("JUMPED\n"); + return 0; + } + foo(env); + printf("FAILED\n"); + return 0; +} + +// CHECK-NOT: FAILED +// CHECK: JUMPED |