1 // RUN: %clang -DOP=n++ -fsanitize=signed-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s
2 // RUN: %clang -DOP=++n -fsanitize=signed-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s
3 // RUN: %clang -DOP=m-- -fsanitize=signed-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s
4 // RUN: %clang -DOP=--m -fsanitize=signed-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s
5
6 #include <stdint.h>
7
main()8 int main() {
9 int n = 0x7ffffffd;
10 n++;
11 n++;
12 int m = -n - 1;
13 // CHECK: incdec-overflow.cpp:15:3: runtime error: signed integer overflow: [[MINUS:-?]]214748364
14 // CHECK: + [[MINUS]]1 cannot be represented in type 'int'
15 OP;
16 }
17