Debian Codegraph @

gcc/testsuite/gcc.dg/fixed-point/func-vararg-size0.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-std=gnu99" } */
3
4 /* C99 6.5.2.2 Function calls.
5 Based on the test from ../dfp/. */
6
7 #include <stdarg.h>
8
9 extern void abort (void);
10
11 struct S1
12 {
13 struct
14 {
15 _Fract e;
16 } b[0];
17 };
18
19 /* Test handling vararg parameters whose size is 0. */
20
21 int check_var(int z,...)
22 {
23 double d;
24 struct S1 s1;
25 long long result;
26 va_list ap;
27 va_start (ap, z);
28 d = va_arg (ap, double);
29 s1 = va_arg (ap, struct S1);
30 result = va_arg (ap, long long);
31 va_end (ap);
32 return (result == 2LL);
33
34 }
35
36 int
37 main ()
38 {
39 struct S1 s1;
40 struct S1 a1[5];
41
42 if (check_var(5, 1.0, s1, 2LL, a1[2], a1[2]) == 0)
43 abort ();
44
45 return 0;
46 }