PR rtl-optimization/88018
[official-gcc.git] / gcc / testsuite / c-c++-common / torture / builtin-arith-overflow-8.c
blob9e1754fed30ddfd0eb979668f3afa1f98856ca78
1 /* Test __builtin_{add,sub}_overflow on {,un}signed short. */
2 /* { dg-do run } */
3 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
5 typedef signed short int S;
6 typedef unsigned short int U;
7 #define COND 1
8 #define SHIFT ((__SIZEOF_SHORT__ - 1) * __CHAR_BIT__)
9 #define S_MAX __SHRT_MAX__
10 #define S_MIN (-__SHRT_MAX__ - 1)
11 #if __SIZEOF_INT__ > __SIZEOF_SHORT__
12 typedef int W;
13 #elif __SIZEOF_LONG__ > __SIZEOF_SHORT__
14 typedef long int W;
15 #elif __SIZEOF_LONG_LONG__ > __SIZEOF_SHORT__
16 typedef long long int W;
17 #elif __SIZEOF_INT128__ > __SIZEOF_SHORT__
18 typedef __int128 W;
19 #else
20 #undef COND
21 #define COND 0
22 #endif
23 #include "builtin-arith-overflow-7.c"