Home | History | Annotate | Download | only in tsan
      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(jmp_buf env) {
     11   longjmp(env, 42);
     12 }
     13 
     14 int main() {
     15   jmp_buf env;
     16   if (setjmp(env) == 42) {
     17     fprintf(stderr, "JUMPED\n");
     18     return 0;
     19   }
     20   foo(env);
     21   fprintf(stderr, "FAILED\n");
     22   return 0;
     23 }
     24 
     25 // CHECK-NOT: FAILED
     26 // CHECK: JUMPED
     27