[compiler-rt] 8b574a1 - [Darwin][UBSan][Sanitizer] abort_on_error ubsan test fix for arm64

Blue Gaston via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 12:23:08 PDT 2022


Author: Blue Gaston
Date: 2022-04-27T12:23:03-07:00
New Revision: 8b574a1e51339e0bf44cd4ded9c704e50ecb5850

URL: https://github.com/llvm/llvm-project/commit/8b574a1e51339e0bf44cd4ded9c704e50ecb5850
DIFF: https://github.com/llvm/llvm-project/commit/8b574a1e51339e0bf44cd4ded9c704e50ecb5850.diff

LOG: [Darwin][UBSan][Sanitizer] abort_on_error ubsan test fix for arm64

The current darwin abort_on_error test specifically tests for a division
by zero undefined behavior. However arm does not trap by default for this
behavior. x86 signals the abort, which is why the test passes on x86.
This patch updates the test to test for a case where the ubsan runtime
specifically calls Die() to trigger an abort by default.

rdar://92108564

Differential Revision: https://reviews.llvm.org/D124480

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp b/compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp
index a7bd7174a455f..f94bd51ed9e04 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Darwin/abort_on_error.cpp
@@ -16,8 +16,8 @@ int global;
 
 int main() {
 #if defined(USING_ubsan)
-  int value = 5;
-  int computation = value / 0; // Division by zero.
+  volatile int *null = 0;
+  *null = 0;
 #else
   volatile int *a = new int[100];
   delete[] a;


        


More information about the llvm-commits mailing list