From: michaelh Date: Tue, 2 Oct 2001 01:10:42 +0000 (+0000) Subject: * support/regression/fwk/lib/testfwk.c (__printf): Removed GENERIC. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=f8d2f13d4536e3fea8e1a0555afe0497a5ba33e1;p=fw%2Fsdcc * support/regression/fwk/lib/testfwk.c (__printf): Removed GENERIC. * support/regression/tests/bug-467035.c: Created. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1341 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/support/regression/fwk/lib/testfwk.c b/support/regression/fwk/lib/testfwk.c index 8a46780e..9f013c2d 100644 --- a/support/regression/fwk/lib/testfwk.c +++ b/support/regression/fwk/lib/testfwk.c @@ -66,7 +66,7 @@ void __printf(const char *szFormat, ...) REENTRANT if (*szFormat == '%') { switch (*++szFormat) { case 's': { - char GENERIC *sz = va_arg(ap, char GENERIC *); + char *sz = va_arg(ap, char *); while (*sz) { _putchar(*sz++); } diff --git a/support/regression/tests/bug-467035.c b/support/regression/tests/bug-467035.c new file mode 100644 index 00000000..dc65895c --- /dev/null +++ b/support/regression/tests/bug-467035.c @@ -0,0 +1,57 @@ +/* Tests a bug in for loops where b in plot_point is always 1. + Stripped down from the gbdk filltest.c + */ +#include + +typedef unsigned char UBYTE; + +UBYTE +getpix(UBYTE x, UBYTE y) +{ + UNUSED(x); + UNUSED(y); + + return 0; +} + +void +color(UBYTE a, UBYTE b, UBYTE c) +{ + UNUSED(a & b & c); +} + +void +line(UBYTE a, UBYTE b, UBYTE c, UBYTE d) +{ + UNUSED(a & b & c & d); +} + +void +plot_point(UBYTE a, UBYTE b) +{ + static UBYTE ea, eb; + + ASSERT(b == eb); + ASSERT(a == ea); + + ea++; + if (ea > 12) { + ea = 0; + eb++; + } + LOG(("(a, b) -> (%u, %u)\n", (unsigned int)a, (unsigned int)b)); +} + +void +testForMerge(void) +{ + UBYTE a,b; + + for (b=0; b<=10U; b++) { + for (a=0; a<=12U; a++) { + color(getpix(a,b+1), 0, 1); + plot_point(a,b); + } + color(0, 0, 1); + } +}