libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / bitint-5.c
blob0adfa31ad1e818a2e30c15532d839877280b0c93
1 /* PR c/102989 */
2 /* { dg-do compile { target bitint } } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
5 #include <stdarg.h>
6 #include <stdlib.h>
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
15 void
16 foo (int a, ...)
18 va_list ap;
19 va_start (ap, a);
20 if (a == 1)
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 ();
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);
44 void
45 bar (void)
47 foo (1, 1wb, 3wb, 16383wb, 4294967295uwb, 9223372036854775807wb,
48 #if __BITINT_MAXWIDTH__ >= 128
50 #endif
51 #if __BITINT_MAXWIDTH__ >= 575
53 #endif
54 42);
55 foo (2,
56 #if __BITINT_MAXWIDTH__ >= 128
58 #endif
59 #if __BITINT_MAXWIDTH__ >= 575
61 #endif
62 42);