struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr64979.c
blob949d5fdbc3d826a512a7848f39deae79c135e8ff
1 /*
2 pr64979.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #pragma disable_warning 93
10 #endif
12 /* PR target/64979 */
14 #include <stdarg.h>
16 #ifndef __SDCC_pdk14 // Lack of memory
17 void
18 bar (int x, va_list *ap)
20 (void)x;
21 if (ap)
23 int i;
24 for (i = 0; i < 10; i++)
25 ASSERT (i == va_arg (*ap, int));
26 ASSERT (va_arg (*ap, double) == 0.5);
30 void
31 foo (int x, ...)
33 va_list ap;
34 int n;
36 va_start (ap, x);
37 n = va_arg (ap, int);
38 bar (x, (va_list *) ((n == 0) ? ((void *) 0) : &ap));
39 va_end (ap);
41 #endif
43 void
44 testTortureExecute (void)
46 #ifndef __SDCC_pdk14 // Lack of memory
47 foo (100, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0.5);
48 return;
49 #endif