From a9f4278108a4d3ec516876d065fa37f989d48b04 Mon Sep 17 00:00:00 2001 From: MaartenBrock Date: Tue, 26 Feb 2008 19:18:32 +0000 Subject: [PATCH] * src/mcs51/ralloc.c (isSpiltOnStack): fixed bug 1565152 * support/regression/tests/bug1565152.c: new, added git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5053 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 5 +++++ src/mcs51/ralloc.c | 6 +++++- support/regression/tests/bug1565152.c | 31 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 support/regression/tests/bug1565152.c diff --git a/ChangeLog b/ChangeLog index 706802d6..dc338bb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-25 Maarten Brock + + * src/mcs51/ralloc.c (isSpiltOnStack): fixed bug 1565152 + * support/regression/tests/bug1565152.c: new, added + 2008-02-26 Borut Razem * src/SDCCast.c, doc/adccman.lyx: fixed RFE #1901171: inerger promotion diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index d4d3ad42..7ce56c40 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -578,6 +578,7 @@ createStackSpil (symbol * sym) /*-----------------------------------------------------------------*/ /* isSpiltOnStack - returns true if the spil location is on stack */ +/* or otherwise needs a pointer register */ /*-----------------------------------------------------------------*/ static bool isSpiltOnStack (symbol * sym) @@ -596,6 +597,9 @@ isSpiltOnStack (symbol * sym) if (!sym->usl.spillLoc) return FALSE; + if (sym->usl.spillLoc->onStack || sym->usl.spillLoc->iaccess) + return TRUE; + etype = getSpec (sym->usl.spillLoc->type); if (IN_STACK (etype)) return TRUE; @@ -664,7 +668,7 @@ selectSpil (iCode * ic, eBBlock * ebp, symbol * forSym) selectS = liveRangesWith (lrcs, bitType, ebp, ic); for (sym = setFirstItem (selectS); sym; sym = setNextItem (selectS)) - { + { bitVectUnSetBit (lrcs, sym->key); } } diff --git a/support/regression/tests/bug1565152.c b/support/regression/tests/bug1565152.c new file mode 100644 index 00000000..b8b42d99 --- /dev/null +++ b/support/regression/tests/bug1565152.c @@ -0,0 +1,31 @@ +/* + bug 1565152.c +*/ + +#include + +// no need to call this, it generates compiler error for xstack-auto +// error 9: FATAL Compiler Internal Error + +#if defined(SDCC_mcs51) +#include <8051.h> + +unsigned int foo(void) +{ + unsigned int i,j; + unsigned long l=0; + + for (i=0;i<10;i++) + { + j=SP; // any SFR would do to generate crash + l+=j; + } + return 1; // <- it gives error on this line +} +#endif + +void +testBug(void) +{ + ASSERT(1); +} -- 2.30.2