1*a68d90faSPeter Collingbourne // RUN: %clangxx -DOP=n++ -fsanitize=unsigned-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck --check-prefix=CHECK-INC %s
2*a68d90faSPeter Collingbourne // RUN: %clangxx -DOP=++n -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck --check-prefix=CHECK-INC %s
3*a68d90faSPeter Collingbourne // RUN: %clangxx -DOP=m-- -fsanitize=unsigned-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck --check-prefix=CHECK-DEC %s
4*a68d90faSPeter Collingbourne // RUN: %clangxx -DOP=--m -fsanitize=unsigned-integer-overflow %s -o %t4 && %run %t4 2>&1 | FileCheck --check-prefix=CHECK-DEC %s
5ba869e79SAlexey Samsonov 
6ba869e79SAlexey Samsonov #include <stdint.h>
7ba869e79SAlexey Samsonov 
main()8ba869e79SAlexey Samsonov int main() {
9ba869e79SAlexey Samsonov   unsigned n = 0xfffffffd;
10ba869e79SAlexey Samsonov   n++;
11ba869e79SAlexey Samsonov   n++;
12ba869e79SAlexey Samsonov   unsigned m = 0;
13ba869e79SAlexey Samsonov   // CHECK-INC: uincdec-overflow.cpp:15:3: runtime error: unsigned integer overflow: 4294967295 + 1 cannot be represented in type 'unsigned int'
14ba869e79SAlexey Samsonov   // CHECK-DEC: uincdec-overflow.cpp:15:3: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
15ba869e79SAlexey Samsonov   OP;
16ba869e79SAlexey Samsonov }
17