From 3dfb228e86bbdd0327755d718a32fcb6add6ddfa Mon Sep 17 00:00:00 2001 From: spth Date: Thu, 14 Aug 2008 13:12:10 +0000 Subject: [PATCH] Fixed #2051348 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5212 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++ src/z80/gen.c | 6 +-- support/regression/tests/bug-2051348.c | 65 ++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 support/regression/tests/bug-2051348.c diff --git a/ChangeLog b/ChangeLog index f8f58ff7..fe77709e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-08-14 Philipp Klaus Krause + * src/z80/gen.c: fixed #2051348 + * support/regression/tests/bug-2051348.c: regression test for #2051348 + 2008-08-10 Raphael Neider * configure.in, diff --git a/src/z80/gen.c b/src/z80/gen.c index 4d9d0ffb..3554803c 100644 --- a/src/z80/gen.c +++ b/src/z80/gen.c @@ -1819,11 +1819,9 @@ aopGet (asmop * aop, int offset, bool bit16) case AOP_PAIRPTR: setupPair (aop->aopu.aop_pairId, aop, offset); if (aop->aopu.aop_pairId==PAIR_IX) - SNPRINTF (buffer, sizeof(buffer), - "!*ixx", 0); + tsprintf (buffer, sizeof(buffer), "!*ixx", offset); else if (aop->aopu.aop_pairId==PAIR_IY) - SNPRINTF (buffer, sizeof(buffer), - "!*iyx", 0); + tsprintf (buffer, sizeof(buffer), "!*iyx", offset); else SNPRINTF (buffer, sizeof(buffer), "(%s)", _pairs[aop->aopu.aop_pairId].name); diff --git a/support/regression/tests/bug-2051348.c b/support/regression/tests/bug-2051348.c new file mode 100644 index 00000000..24a20d68 --- /dev/null +++ b/support/regression/tests/bug-2051348.c @@ -0,0 +1,65 @@ +/* + bug 2051348. +*/ + +#include + +#pragma disable_warning 85 + +typedef char BOOLEAN; +typedef signed char SHORTINT; + +void App_PutSprite (SHORTINT x, SHORTINT y, SHORTINT spr) +{ +} + +static SHORTINT Labirint_objCell, Labirint_manX, Labirint_manY, Labirint_manDirX, Labirint_manDirY; +static BOOLEAN Labirint_manPresent; + +static SHORTINT Labirint_GetManSprite (void) +{ + return(0); +} + +static BOOLEAN Labirint_ManCanGo (void) +{ + return(0); +} + +static BOOLEAN Labirint_ManGoing (SHORTINT x, SHORTINT y) +{ + return(0); +} + +static void Labirint_SetCell (SHORTINT x, SHORTINT y, SHORTINT cell) +{ +} + +static void Labirint_TryMoveMan (void) +{ + SHORTINT x, y, manSprite; + if (Labirint_ManCanGo()) { + x = (Labirint_manX + Labirint_manDirX) + Labirint_manDirX; + y = (Labirint_manY + Labirint_manDirY) + Labirint_manDirY; + Labirint_manPresent = Labirint_ManGoing(x, y); + if (!Labirint_manPresent) { + return; + } + manSprite = Labirint_GetManSprite(); + Labirint_SetCell(x, y, manSprite); + App_PutSprite(Labirint_manX, Labirint_manY, 0); + // Assembly fails for the next two lines. + Labirint_manX = Labirint_manX + Labirint_manDirX; + Labirint_manY = Labirint_manY + Labirint_manDirY; + } else { + manSprite = 4; + } + App_PutSprite(Labirint_manX, Labirint_manY, manSprite); +} + +void +testBug2051348(void) +{ + ASSERT(1); +} + -- 2.47.2