realized last bug impacted genPlus as well
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 20 Sep 2000 20:38:23 +0000 (20:38 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 20 Sep 2000 20:38:23 +0000 (20:38 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@392 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/ds390/gen.c

index 6895f2c324026edaa4ffe33fb3ea435a4e48a5b0..6edba6ff2533295f8a7c962119128e315e4e7903 100644 (file)
@@ -2884,6 +2884,19 @@ static void genPlus (iCode *ic)
 
         size = getDataSize(IC_LEFT(ic));
 
+       /* If the pushed data is bigger than the result,
+        * simply discard unused bytes. Icky, but works.
+        *
+        * Should we throw a warning here? We're losing data...
+        */
+       while (size > getDataSize(IC_RESULT(ic)))
+       {
+          emitcode(";", "discarding unused result byte.");
+          emitcode("pop", "acc");
+          size--;
+          offset--; 
+       }
+
         while(size--)
         {
             emitcode("pop", "acc");