1*7c3d14c8STreehugger Robot // RUN: %clangxx -DOP=n++ -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=PLUS
2*7c3d14c8STreehugger Robot // RUN: %clangxx -DOP=++n -fsanitize=signed-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=PLUS
3*7c3d14c8STreehugger Robot // RUN: %clangxx -DOP=m-- -fsanitize=signed-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=MINUS
4*7c3d14c8STreehugger Robot // RUN: %clangxx -DOP=--m -fsanitize=signed-integer-overflow %s -o %t4 && %run %t4 2>&1 | FileCheck %s --check-prefix=MINUS
5*7c3d14c8STreehugger Robot
6*7c3d14c8STreehugger Robot #include <stdint.h>
7*7c3d14c8STreehugger Robot
main()8*7c3d14c8STreehugger Robot int main() {
9*7c3d14c8STreehugger Robot int n = 0x7ffffffd;
10*7c3d14c8STreehugger Robot n++;
11*7c3d14c8STreehugger Robot n++;
12*7c3d14c8STreehugger Robot int m = -n - 1;
13*7c3d14c8STreehugger Robot OP;
14*7c3d14c8STreehugger Robot // PLUS: incdec-overflow.cpp:[[@LINE-1]]:3: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
15*7c3d14c8STreehugger Robot // MINUS: incdec-overflow.cpp:[[@LINE-2]]:3: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
16*7c3d14c8STreehugger Robot }
17