struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2363.c
blobfe3f6d62107ec861508698fa301110ae489f7d31
1 /*
2 bug-2363.c, SDCC got confused by the use of uninitialized variables, resulting in assertion failures.
3 */
5 #include <testfwk.h>
7 #pragma disable_warning 84
9 #define X(i, ub) (i)
11 typedef struct Durak_Card { signed char suit, rank; } Durak_Card;
13 typedef Durak_Card Durak_Cards[37];
15 #if !(defined(__SDCC_mcs51) && defined(__SDCC_MODEL_SMALL)) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !defined(__SDCC_pic14) // Not enough memory
16 static Durak_Cards Durak_hand[2];
17 static Durak_Card Durak_desk[13];
18 static signed char Durak_deskN, Durak_trump, Durak_badSuit;
19 #endif
21 static void Durak_CpuMoves (void)
23 #if !(defined(__SDCC_mcs51) && defined(__SDCC_MODEL_SMALL)) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !defined(__SDCC_pic14) // Not enough memory
24 signed char i, l;
25 signed int z;
26 signed char _for__14;
28 if (Durak_deskN != 0) {
29 if (Durak_desk[X(Durak_deskN, 13)].suit == Durak_trump && Durak_desk[X(i - 1, 13)].suit != Durak_trump) {
30 Durak_badSuit = Durak_desk[X(i - 1, 13)].suit;
33 while (l <= _for__14) {
34 for (;;) {
35 i = l;
36 if ((Durak_hand[1][X(l, 37)].rank)) {
37 z = Durak_hand[1][X(i, 37)].rank * 10 + (signed char)(Durak_hand[1][X(i, 37)].suit == Durak_trump) * 111;
41 #endif
44 void testBug(void)