2 /* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable -fno-sanitize-recover=signed-integer-overflow" } */
4 #define SCHAR_MAX __SCHAR_MAX__
5 #define SCHAR_MIN (-__SCHAR_MAX__ - 1)
6 #define SHRT_MAX __SHRT_MAX__
7 #define SHRT_MIN (-__SHRT_MAX__ - 1)
8 #define INT_MAX __INT_MAX__
9 #define INT_MIN (-__INT_MAX__ - 1)
11 void __attribute__((noinline
,noclone
))
21 #if __INT_MAX__ == 2147483647
22 /* Here, nothing should fail. */
24 volatile int j
= INT_MIN
;
25 volatile int k
= j
- i
;
26 check (k
, -2147483647);
28 check (k
, 2147483647);
30 check (j
, -2147483647);
35 check (k
, -2147483646);
37 check (k
, 2147483646);
39 check (k
, 2147483646);
42 /* Test integer promotion. */
43 #if __SCHAR_MAX__ == 127
44 volatile signed char a
= SCHAR_MIN
;
45 volatile signed char b
= 1;
46 volatile signed char c
= a
- b
;
52 #if __SHRT_MAX__ == 32767
53 volatile short d
= SHRT_MIN
;
55 volatile short f
= d
- e
;