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(jmp_buf env) {
8 longjmp(env: env, val: 42);
9}
10
11int main() {
12 jmp_buf env;
13 if (setjmp(env) == 42) {
14 fprintf(stderr, format: "JUMPED\n");
15 return 0;
16 }
17 foo(env);
18 fprintf(stderr, format: "FAILED\n");
19 return 0;
20}
21
22// CHECK-NOT: FAILED
23// CHECK: JUMPED
24

source code of compiler-rt/test/tsan/longjmp.cpp