struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-467035.c
blobdc65895c65c53af40528f25ed47b1d58474696eb
1 /* Tests a bug in for loops where b in plot_point is always 1.
2 Stripped down from the gbdk filltest.c
3 */
4 #include <testfwk.h>
6 typedef unsigned char UBYTE;
8 UBYTE
9 getpix(UBYTE x, UBYTE y)
11 UNUSED(x);
12 UNUSED(y);
14 return 0;
17 void
18 color(UBYTE a, UBYTE b, UBYTE c)
20 UNUSED(a & b & c);
23 void
24 line(UBYTE a, UBYTE b, UBYTE c, UBYTE d)
26 UNUSED(a & b & c & d);
29 void
30 plot_point(UBYTE a, UBYTE b)
32 static UBYTE ea, eb;
34 ASSERT(b == eb);
35 ASSERT(a == ea);
37 ea++;
38 if (ea > 12) {
39 ea = 0;
40 eb++;
42 LOG(("(a, b) -> (%u, %u)\n", (unsigned int)a, (unsigned int)b));
45 void
46 testForMerge(void)
48 UBYTE a,b;
50 for (b=0; b<=10U; b++) {
51 for (a=0; a<=12U; a++) {
52 color(getpix(a,b+1), 0, 1);
53 plot_point(a,b);
55 color(0, 0, 1);