emitcodePointerGet was badly broken
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 29 Sep 2000 16:19:08 +0000 (16:19 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 29 Sep 2000 16:19:08 +0000 (16:19 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@418 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/ds390/gen.c

index 92089ca88d4e84707d447f8e45470bcf2a506897..db46a30fa4c51a67455195f18534077a82340386 100644 (file)
@@ -6946,7 +6946,7 @@ static void emitcodePointerGet (operand *left,
     }
     /* so dptr know contains the address */
     freeAsmop(left,NULL,ic,TRUE);
-    aopOp(result,ic,FALSE, FALSE);
+    aopOp(result,ic,FALSE, TRUE);
 
     /* if bit then unpack */
     if (IS_BITVAR(retype)) 
@@ -6955,13 +6955,19 @@ static void emitcodePointerGet (operand *left,
         size = AOP_SIZE(result);
         offset = 0 ;
 
-        while (size--) {
+       _startLazyDPSEvaluation();
+        while (size--) 
+        {
+            genSetDPTR(0);
+            _flushLazyDPS();
+                              
             emitcode("clr","a");
             emitcode("movc","a,@a+dptr");
-            aopPut(AOP(result),"a",offset++);
             if (size)
-                emitcode("inc","dptr");
+                emitcode("inc","dptr");            
+            aopPut(AOP(result),"a",offset++);
         }
+        _endLazyDPSEvaluation();
     }
 
     freeAsmop(result,NULL,ic,TRUE);