]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/tsan/longjmp.cc
New upstream version 1.19.0+dfsg1
[rustc.git] / src / compiler-rt / test / tsan / longjmp.cc
CommitLineData
1a4d82fc 1// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
92a42be0 2
1a4d82fc
JJ
3#include <stdio.h>
4#include <stdlib.h>
5#include <setjmp.h>
6
7int foo(jmp_buf env) {
8 longjmp(env, 42);
9}
10
11int main() {
12 jmp_buf env;
13 if (setjmp(env) == 42) {
5bcae85e 14 fprintf(stderr, "JUMPED\n");
1a4d82fc
JJ
15 return 0;
16 }
17 foo(env);
5bcae85e 18 fprintf(stderr, "FAILED\n");
1a4d82fc
JJ
19 return 0;
20}
21
22// CHECK-NOT: FAILED
23// CHECK: JUMPED