Debian Codegraph @

gcc/testsuite/gcc.dg/bitint-5.c

raw
1 /* PR c/102989 */
2 /* { dg-do compile { target bitint } } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
4
5 #include <stdarg.h>
6 #include <stdlib.h>
7
8 #if __BITINT_MAXWIDTH__ >= 128
9 unsigned _BitInt(128) b, c;
10 #endif
11 #if __BITINT_MAXWIDTH__ >= 575
12 signed _BitInt(575) d, e;
13 #endif
14
15 void
16 foo (int a, ...)
17 {
18 va_list ap;
19 va_start (ap, a);
20 if (a == 1)
21 {
22 if (va_arg (ap, _BitInt(2)) != 1wb)
23 abort ();
24 if (va_arg (ap, _BitInt(3)) != 3wb)
25 abort ();
26 if (va_arg (ap, _BitInt(15)) != 16383wb)
27 abort ();
28 if (va_arg (ap, unsigned _BitInt(32)) != 4294967295uwb)
29 abort ();
30 if (va_arg (ap, _BitInt(64)) != 0x7fffffffffffffffwb)
31 abort ();
32 }
33 #if __BITINT_MAXWIDTH__ >= 128
34 b = va_arg (ap, unsigned _BitInt(128));
35 #endif
36 #if __BITINT_MAXWIDTH__ >= 575
37 d = va_arg (ap, _BitInt(575));
38 #endif
39 if (va_arg (ap, int) != 42)
40 abort ();
41 va_end (ap);
42 }
43
44 void
45 bar (void)
46 {
47 foo (1, 1wb, 3wb, 16383wb, 4294967295uwb, 9223372036854775807wb,
48 #if __BITINT_MAXWIDTH__ >= 128
49 c,
50 #endif
51 #if __BITINT_MAXWIDTH__ >= 575
52 e,
53 #endif
54 42);
55 foo (2,
56 #if __BITINT_MAXWIDTH__ >= 128
57 c,
58 #endif
59 #if __BITINT_MAXWIDTH__ >= 575
60 e,
61 #endif
62 42);
63 }