diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-02-14 11:42:22 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-02-14 11:42:22 +0000 |
commit | ba869e79a050ada6a3a3fbeeb275313ab8fdf438 (patch) | |
tree | 2a0fa6f117c0f095b8efdc446cb3e57c37616db5 /compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp | |
parent | 05938a23f5fdf299bdbf1b7162ec71f0e600d9b3 (diff) | |
download | bcm5719-llvm-ba869e79a050ada6a3a3fbeeb275313ab8fdf438.tar.gz bcm5719-llvm-ba869e79a050ada6a3a3fbeeb275313ab8fdf438.zip |
Move UBSan test suite under test/
llvm-svn: 201401
Diffstat (limited to 'compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp')
-rw-r--r-- | compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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 <stdint.h> + +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; +} |