summaryrefslogtreecommitdiff
path: root/test/ubsan/TestCases/Misc
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2015-04-29 20:39:10 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2015-04-29 20:39:10 +0000
commitdef30044f804433cf05bd7ca6444557292329c93 (patch)
treebcbaa44ebb4b90a8eee5d50574f3caec6c6c9578 /test/ubsan/TestCases/Misc
parent23e179c4d4e6cfcb647ce1faf22f3c05466ff746 (diff)
[UBSan] Add a testcase for __ubsan_default_options() function.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236151 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ubsan/TestCases/Misc')
-rw-r--r--test/ubsan/TestCases/Misc/Linux/ubsan_options.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc b/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc
new file mode 100644
index 000000000..2be8792cc
--- /dev/null
+++ b/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc
@@ -0,0 +1,18 @@
+// RUN: %clangxx -fsanitize=integer -fsanitize-recover=integer %s -o %t
+// RUN: not %t 2>&1 | FileCheck %s
+
+// __ubsan_default_options() doesn't work on Darwin.
+// XFAIL: darwin
+
+#include <stdint.h>
+
+extern "C" const char *__ubsan_default_options() {
+ return "halt_on_error=1";
+}
+
+int main() {
+ (void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
+ // CHECK: ubsan_options.cc:[[@LINE-1]]:44: runtime error: unsigned integer overflow
+ return 0;
+}
+