From 0b8b287b8de2f5df2b459b61d36dfa6c2fb1cf0a Mon Sep 17 00:00:00 2001 From: sandeep Date: Wed, 13 Sep 2000 16:34:18 +0000 Subject: [PATCH] fixed the pointers alive across function calls git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@355 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCcse.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/SDCCcse.c b/src/SDCCcse.c index 72129a29..952a3050 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -376,6 +376,17 @@ DEFSETFUNC(ifDefGlobal) return (isOperandGlobal(cdp->sym)); } +/*-----------------------------------------------------------------*/ +/* ifAnyGetPointer - if get pointer icode */ +/*-----------------------------------------------------------------*/ +DEFSETFUNC(ifAnyGetPointer) +{ + cseDef *cdp = item; + + if (cdp->diCode && POINTER_GET(cdp->diCode)) return 1; + return 0; +} + /*-----------------------------------------------------------------*/ /* ifOperandsHave - if any of the operand are the same as this */ /*-----------------------------------------------------------------*/ @@ -1199,6 +1210,10 @@ int cseBBlock ( eBBlock *ebb, int computeOnly, /* delete global variables from the cseSet since they can be modified by the function call */ deleteItemIf(&cseSet,ifDefGlobal); + /* delete all getpointer iCodes from cseSet, this should + be done only for global arrays & pointers but at this + point we don't know if globals, so to be safe do all*/ + deleteItemIf(&cseSet,ifAnyGetPointer); } /* for pcall & ipush we need to add to the useSet */ -- 2.30.2