Debian Codegraph @

gcc/testsuite/gcc.dg/torture/bitint-45.c

raw
1 /* PR middle-end/112750 */
2 /* { dg-do run { target bitint } } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
4 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
5 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
6
7 #if __BITINT_MAXWIDTH__ >= 256
8 _BitInt(256) a = __INT_MAX__ + (_BitInt(256)) 1;
9 _BitInt(256) b = __INT_MAX__;
10 #endif
11 #if __BITINT_MAXWIDTH__ >= 512
12 _BitInt(512) c = 0x7fffffffffffffffffffffffffffffffffffffffwb + (_BitInt(512)) 1;
13 _BitInt(512) d = 0x7fffffffffffffffffffffffffffffffffffffffwb;
14 #endif
15
16 int
17 main ()
18 {
19 #if __BITINT_MAXWIDTH__ >= 256
20 if (!__builtin_sub_overflow_p (a, 0, 0))
21 __builtin_abort ();
22 if (!__builtin_sub_overflow_p (b, -1, 0))
23 __builtin_abort ();
24 #endif
25 #if __BITINT_MAXWIDTH__ >= 512
26 if (!__builtin_sub_overflow_p (c, 0, (_BitInt(160)) 0))
27 __builtin_abort ();
28 if (!__builtin_sub_overflow_p (d, -1, 0))
29 __builtin_abort ();
30 #endif
31 return 0;
32 }