Move use of __builtin_longjmp under the same conditions as the only
authorJoerg Sonnenberger <joerg@bec.de>
Thu, 5 Mar 2015 20:17:05 +0000 (20:17 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Thu, 5 Mar 2015 20:17:05 +0000 (20:17 +0000)
caller of the function.

llvm-svn: 231402

compiler-rt/lib/asan/tests/asan_test.cc

index 853b85f..aa08080 100644 (file)
@@ -569,7 +569,7 @@ TEST(AddressSanitizer, LongJmpTest) {
 }
 
 #if !defined(_WIN32)  // Only basic longjmp is available on Windows.
-NOINLINE void BuiltinLongJmpFunc1(jmp_buf buf) {
+NOINLINE void UnderscopeLongJmpFunc1(jmp_buf buf) {
   // create three red zones for these two stack objects.
   int a;
   int b;
@@ -577,10 +577,10 @@ NOINLINE void BuiltinLongJmpFunc1(jmp_buf buf) {
   int *A = Ident(&a);
   int *B = Ident(&b);
   *A = *B;
-  __builtin_longjmp((void**)buf, 1);
+  _longjmp(buf, 1);
 }
 
-NOINLINE void UnderscopeLongJmpFunc1(jmp_buf buf) {
+NOINLINE void SigLongJmpFunc1(sigjmp_buf buf) {
   // create three red zones for these two stack objects.
   int a;
   int b;
@@ -588,10 +588,13 @@ NOINLINE void UnderscopeLongJmpFunc1(jmp_buf buf) {
   int *A = Ident(&a);
   int *B = Ident(&b);
   *A = *B;
-  _longjmp(buf, 1);
+  siglongjmp(buf, 1);
 }
 
-NOINLINE void SigLongJmpFunc1(sigjmp_buf buf) {
+#if !defined(__ANDROID__) && !defined(__arm__) && \
+    !defined(__powerpc64__) && !defined(__powerpc__) && \
+    !defined(__aarch64__)
+NOINLINE void BuiltinLongJmpFunc1(jmp_buf buf) {
   // create three red zones for these two stack objects.
   int a;
   int b;
@@ -599,12 +602,9 @@ NOINLINE void SigLongJmpFunc1(sigjmp_buf buf) {
   int *A = Ident(&a);
   int *B = Ident(&b);
   *A = *B;
-  siglongjmp(buf, 1);
+  __builtin_longjmp((void**)buf, 1);
 }
 
-#if !defined(__ANDROID__) && !defined(__arm__) && \
-    !defined(__powerpc64__) && !defined(__powerpc__) && \
-    !defined(__aarch64__)
 // Does not work on Power and ARM:
 // https://code.google.com/p/address-sanitizer/issues/detail?id=185
 TEST(AddressSanitizer, BuiltinLongJmpTest) {