[compiler-rt] r236151 - [UBSan] Add a testcase for __ubsan_default_options() function.

Alexey Samsonov vonosmas at gmail.com
Wed Apr 29 13:39:11 PDT 2015


Author: samsonov
Date: Wed Apr 29 15:39:10 2015
New Revision: 236151

URL: http://llvm.org/viewvc/llvm-project?rev=236151&view=rev
Log:
[UBSan] Add a testcase for __ubsan_default_options() function.

Added:
    compiler-rt/trunk/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc

Added: compiler-rt/trunk/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc?rev=236151&view=auto
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc (added)
+++ compiler-rt/trunk/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc Wed Apr 29 15:39:10 2015
@@ -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;
+}
+





More information about the llvm-commits mailing list