From ba869e79a050ada6a3a3fbeeb275313ab8fdf438 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 14 Feb 2014 11:42:22 +0000 Subject: Move UBSan test suite under test/ llvm-svn: 201401 --- .../test/ubsan/TestCases/Integer/uincdec-overflow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp (limited to 'compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp') diff --git a/compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp b/compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp new file mode 100644 index 00000000000..a14bd6a776f --- /dev/null +++ b/compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp @@ -0,0 +1,16 @@ +// RUN: %clangxx -DOP=n++ -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck --check-prefix=CHECK-INC %s +// RUN: %clangxx -DOP=++n -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck --check-prefix=CHECK-INC %s +// RUN: %clangxx -DOP=m-- -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck --check-prefix=CHECK-DEC %s +// RUN: %clangxx -DOP=--m -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck --check-prefix=CHECK-DEC %s + +#include + +int main() { + unsigned n = 0xfffffffd; + n++; + n++; + unsigned m = 0; + // CHECK-INC: uincdec-overflow.cpp:15:3: runtime error: unsigned integer overflow: 4294967295 + 1 cannot be represented in type 'unsigned int' + // CHECK-DEC: uincdec-overflow.cpp:15:3: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int' + OP; +} -- cgit v1.2.3