struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr44575.c
blobb0c5ee28e151a66cfe7f9d2fc41613e222e3f5bb
1 /*
2 pr44575.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* PR target/44575 */
13 #include <stdarg.h>
15 #ifndef __SDCC_pdk14 // Lack of memory
16 int fails = 0;
17 struct S { float a[3]; };
18 struct S a[5];
20 void
21 check (int z, ...)
23 struct S arg, *p;
24 va_list ap;
25 int j = 0, k = 0;
26 int i;
27 va_start (ap, z);
28 for (i = 2; i < 4; ++i)
30 p = 0;
31 j++;
32 k += 2;
33 switch ((z << 4) | i)
35 case 0x12:
36 case 0x13:
37 p = &a[2];
38 arg = va_arg (ap, struct S);
39 break;
40 default:
41 ++fails;
42 break;
44 if (p && p->a[2] != arg.a[2])
45 ++fails;
46 if (fails)
47 break;
49 va_end (ap);
51 #endif
53 void
54 testTortureExecute (void)
56 #ifndef __SDCC_pdk14 // Lack of memory
57 a[2].a[2] = -49026;
58 check (1, a[2], a[2]);
59 if (fails)
60 ASSERT (0);
61 return;
62 #endif