struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20090527-1.c
blobe767081bd9ecc5bf9c925bb0a98e1b321e5a002e
1 /*
2 20090527-1.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 typedef enum { POSITION_ASIS, POSITION_UNSPECIFIED } unit_position;
13 typedef enum { STATUS_UNKNOWN, STATUS_UNSPECIFIED } unit_status;
15 typedef struct
17 unit_position position;
18 unit_status status;
19 } unit_flags;
21 extern void abort (void);
23 void
24 new_unit (unit_flags * flags)
26 if (flags->status == STATUS_UNSPECIFIED)
27 flags->status = STATUS_UNKNOWN;
29 if (flags->position == POSITION_UNSPECIFIED)
30 flags->position = POSITION_ASIS;
32 switch (flags->status)
34 case STATUS_UNKNOWN:
35 break;
37 default:
38 ASSERT (0);
42 void
43 testTortureExecute (void)
45 unit_flags f;
46 f.status = STATUS_UNSPECIFIED;
47 new_unit (&f);
48 return;