llvm-project
23 строки · 373.0 Байт
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) {
8longjmp(env, 42);
9}
10
11int main() {
12jmp_buf env;
13if (setjmp(env) == 42) {
14fprintf(stderr, "JUMPED\n");
15return 0;
16}
17foo(env);
18fprintf(stderr, "FAILED\n");
19return 0;
20}
21
22// CHECK-NOT: FAILED
23// CHECK: JUMPED
24