[UBSan] Add a testcase for __ubsan_default_options() function.
authorAlexey Samsonov <vonosmas@gmail.com>
Wed, 29 Apr 2015 20:39:10 +0000 (20:39 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Wed, 29 Apr 2015 20:39:10 +0000 (20:39 +0000)
llvm-svn: 236151

compiler-rt/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc [new file with mode: 0644]

diff --git a/compiler-rt/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc b/compiler-rt/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc
new file mode 100644 (file)
index 0000000..2be8792
--- /dev/null
@@ -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;
+}
+