diff options
| author | Will Dietz <wdietz2@illinois.edu> | 2012-11-27 15:01:43 +0000 |
|---|---|---|
| committer | Will Dietz <wdietz2@illinois.edu> | 2012-11-27 15:01:43 +0000 |
| commit | 2631aaf93934af22a360595c5bca4ef0f9407403 (patch) | |
| tree | 7105fd664efdf5617b68259f67b9449762ab4784 /compiler-rt/lib/ubsan/lit_tests/Integer/uincdec-overflow.cpp | |
| parent | b7029398f3847f02199c877e7cc75a23ded80b1c (diff) | |
| download | bcm5719-llvm-2631aaf93934af22a360595c5bca4ef0f9407403.tar.gz bcm5719-llvm-2631aaf93934af22a360595c5bca4ef0f9407403.zip | |
ubsan: Support unsigned overflows, and divide-by-zero int/float split.
llvm-svn: 168700
Diffstat (limited to 'compiler-rt/lib/ubsan/lit_tests/Integer/uincdec-overflow.cpp')
| -rw-r--r-- | compiler-rt/lib/ubsan/lit_tests/Integer/uincdec-overflow.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler-rt/lib/ubsan/lit_tests/Integer/uincdec-overflow.cpp b/compiler-rt/lib/ubsan/lit_tests/Integer/uincdec-overflow.cpp new file mode 100644 index 00000000000..45df7088312 --- /dev/null +++ b/compiler-rt/lib/ubsan/lit_tests/Integer/uincdec-overflow.cpp @@ -0,0 +1,16 @@ +// RUN: %clang -DOP=n++ -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck --check-prefix=INC %s +// RUN: %clang -DOP=++n -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck --check-prefix=INC %s +// RUN: %clang -DOP=m-- -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck --check-prefix=DEC %s +// RUN: %clang -DOP=--m -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck --check-prefix=DEC %s + +#include <stdint.h> + +int main() { + unsigned n = 0xfffffffd; + n++; + n++; + unsigned m = 0; + // CHECK-INC: uincdec-overflow.cpp:15:3: fatal error: unsigned integer overflow: 4294967295 + 1 cannot be represented in type 'unsigned int' + // CHECK-DEC: uincdec-overflow.cpp:15:3: fatal error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int' + OP; +} |

