1// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <setjmp.h>
6
7int foo(sigjmp_buf env) {
8 printf("env=%p\n", env);
9 siglongjmp(env, 42);
10}
11
12int main() {
13 sigjmp_buf env;
14 printf("env=%p\n", env);
15 if (sigsetjmp(env, 1) == 42) {
16 fprintf(stderr, "JUMPED\n");
17 return 0;
18 }
19 foo(env);
20 fprintf(stderr, "FAILED\n");
21 return 0;
22}
23
24// CHECK-NOT: FAILED
25// CHECK: JUMPED
26