From: bernhardheld Date: Sat, 27 May 2006 20:50:29 +0000 (+0000) Subject: * src/SDCCcse.c (findPointerSet): fixed bug #1493710 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=81096b2cb05e1aa87dec1b0a02d11754f7f1ed6d;hp=bcffce0130d38cca654e3867a632f089ce4cf69e;p=fw%2Fsdcc * src/SDCCcse.c (findPointerSet): fixed bug #1493710 * support/regression/tests/bug-1493710.c: added git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4195 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 0c5d8b59..3063744f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-27 Bernhard Held + + * src/SDCCcse.c (findPointerSet): fixed bug #1493710 + * support/regression/tests/bug-1493710.c: added + 2006-05-27 Borut Razem * support/regression/fwk/lib/testfwk.c: define array in _printn() as diff --git a/src/SDCCcse.c b/src/SDCCcse.c index 35a5df94..df360ff0 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -175,6 +175,13 @@ replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset) { iCode *lic; +#ifdef RANGEHUNT + printf ("replaceAllSymBySym\n\t"); + printOperand (from, stdout); + printf ("\nwith\t"); + printOperand (to, stdout); + printf ("\n"); +#endif for (lic = ic; lic; lic = lic->next) { int siaddr; @@ -471,6 +478,16 @@ DEFSETFUNC (findPointerSet) getSize (operandType (IC_RIGHT (cdp->diCode))) == getSize (operandType (rop))) { + if (IS_SPEC (operandType (IC_RIGHT (cdp->diCode))) && + SPEC_USIGN (operandType (IC_RIGHT (cdp->diCode))) != + SPEC_USIGN (operandType (rop))) + { + /* bug #1493710 + Reminder for Bernhard: check of signedness + could be unnecessary together with 'checkSign', if + signedness of operation is stored in ic */ + return 0; + } *opp = IC_RIGHT (cdp->diCode); return 1; } diff --git a/support/regression/tests/bug-1493710.c b/support/regression/tests/bug-1493710.c new file mode 100644 index 00000000..ab5991d9 --- /dev/null +++ b/support/regression/tests/bug-1493710.c @@ -0,0 +1,27 @@ +/* + bug-1493710.c + + cse + findPointerSet with signed/unsigned operands +*/ + +#include + +struct + { + unsigned char a; + } st = { 0xff }; + +signed char c = -1; + +unsigned char f (void) +{ + st.a += c; + return st.a > 8; +} + +void +testFindPointerSet(void) +{ + ASSERT(f() == 1); +}