2014-05-01 05:34:17 +08:00
|
|
|
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
|
2015-05-08 20:58:03 +08:00
|
|
|
|
2015-11-16 21:55:19 +08:00
|
|
|
// Longjmp assembly has not been implemented for mips64 yet
|
2015-05-08 20:58:03 +08:00
|
|
|
// XFAIL: mips64
|
|
|
|
|
2013-03-25 18:10:44 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
|
|
|
int foo(jmp_buf env) {
|
|
|
|
longjmp(env, 42);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
jmp_buf env;
|
|
|
|
if (setjmp(env) == 42) {
|
2016-04-15 20:34:00 +08:00
|
|
|
fprintf(stderr, "JUMPED\n");
|
2013-03-25 18:10:44 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
foo(env);
|
2016-04-15 20:34:00 +08:00
|
|
|
fprintf(stderr, "FAILED\n");
|
2013-03-25 18:10:44 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-NOT: FAILED
|
|
|
|
// CHECK: JUMPED
|