Steve Tell fixed a nested for-loop bug in the PIC Port
authorsdattalo <sdattalo@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 30 Mar 2003 14:45:55 +0000 (14:45 +0000)
committersdattalo <sdattalo@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 30 Mar 2003 14:45:55 +0000 (14:45 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2430 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/pic/gen.c
src/regression/Makefile

index 7e1c71affae5eaf55c1a9d49b2666ecc22acba5a..1f9da1caba159957b5f961b8e88d22d0ed372ef6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-03-30  Scott Dattalo  <scott@dattalo.com>
+
+       * src/pic/gen.c: Commit patch from Steve Tell <tell@telltronics.org> 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 <bernhard@bernhardheld.de>
 
        * support/Util/dbuf.h: remove C++ stuff to make it portable
index ba4a10fc546dbaed67ef800a171c48da71902850..e77ea3b64513c643c004526a3f893433080f06cb 100644 (file)
@@ -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;
 
index 8cfaabf0e8edaa5153d6fe3fd968e9d8d2b01828..9cf8dae670fbda289c2e33fa7f6950c040d1f59a 100644 (file)
@@ -77,6 +77,7 @@ SRC = b.c \
        compare5.c \
        compare6.c \
        for.c \
+       nestfor.c \
        or1.c \
        rotate1.c \
        rotate2.c \