]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/tsan/longjmp2.cc
New upstream version 1.12.0+dfsg1
[rustc.git] / src / compiler-rt / test / tsan / longjmp2.cc
1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
2
3 // Longjmp assembly has not been implemented for mips64 yet
4 // XFAIL: mips64
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <setjmp.h>
9
10 int foo(sigjmp_buf env) {
11 printf("env=%p\n", env);
12 siglongjmp(env, 42);
13 }
14
15 int main() {
16 sigjmp_buf env;
17 printf("env=%p\n", env);
18 if (sigsetjmp(env, 1) == 42) {
19 fprintf(stderr, "JUMPED\n");
20 return 0;
21 }
22 foo(env);
23 fprintf(stderr, "FAILED\n");
24 return 0;
25 }
26
27 // CHECK-NOT: FAILED
28 // CHECK: JUMPED