From b69fa3747f96e99c3e88aec80338a10bc8deac4b Mon Sep 17 00:00:00 2001 From: sdattalo Date: Sun, 30 Mar 2003 14:45:55 +0000 Subject: [PATCH] Steve Tell fixed a nested for-loop bug in the PIC Port git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2430 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 7 +++++++ src/pic/gen.c | 12 +++++++++--- src/regression/Makefile | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e1c71af..1f9da1ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-03-30 Scott Dattalo + + * src/pic/gen.c: Commit patch from Steve Tell that fixes + a nested for loop bug in the PIC port + * src/regression/nestfor.c: new regression test file Steve wrote to test nested + for loops + 2003-03-29 Bernhard Held * support/Util/dbuf.h: remove C++ stuff to make it portable diff --git a/src/pic/gen.c b/src/pic/gen.c index ba4a10fc..e77ea3b6 100644 --- a/src/pic/gen.c +++ b/src/pic/gen.c @@ -4086,6 +4086,7 @@ static void genCmp (operand *left,operand *right, genSkipc(&rFalseIfx); break; } + if(ifx) ifx->generated = 1; } else { /* unsigned comparisons to a literal byte */ @@ -4093,10 +4094,12 @@ static void genCmp (operand *left,operand *right, case 0: emitpcode(POC_MOVFW, popGet(AOP(right),0)); genSkipz2(&rFalseIfx,0); + if(ifx) ifx->generated = 1; break; case 0x7f: rFalseIfx.condition ^= 1; genSkipCond(&rFalseIfx,right,0,7); + if(ifx) ifx->generated = 1; break; default: @@ -4104,17 +4107,20 @@ static void genCmp (operand *left,operand *right, emitpcode(POC_SUBFW, popGet(AOP(right),0)); DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); rFalseIfx.condition ^= 1; - if (AOP_TYPE(result) == AOP_CRY) + if (AOP_TYPE(result) == AOP_CRY) { genSkipc(&rFalseIfx); - else { + if(ifx) ifx->generated = 1; + } else { + DEBUGpic14_emitcode ("; ***","%s %d RFIfx.cond=%d",__FUNCTION__,__LINE__, rFalseIfx.condition); emitpcode(POC_CLRF, popGet(AOP(result),0)); emitpcode(POC_RLF, popGet(AOP(result),0)); + emitpcode(POC_MOVLW, popGetLit(0x01)); + emitpcode(POC_XORWF, popGet(AOP(result),0)); } break; } } - if(ifx) ifx->generated = 1; //goto check_carry; return; diff --git a/src/regression/Makefile b/src/regression/Makefile index 8cfaabf0..9cf8dae6 100644 --- a/src/regression/Makefile +++ b/src/regression/Makefile @@ -77,6 +77,7 @@ SRC = b.c \ compare5.c \ compare6.c \ for.c \ + nestfor.c \ or1.c \ rotate1.c \ rotate2.c \ -- 2.30.2