Fixed #1292721
authorspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 17 Mar 2008 13:52:00 +0000 (13:52 +0000)
committerspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 17 Mar 2008 13:52:00 +0000 (13:52 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5107 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/z80/ralloc.c
support/regression/tests/bug-1292721.c [new file with mode: 0644]

index fc3cfd1dc7177530d91868287d09e28cb404d4a1..b9cba56cbc94373a0853b816afb3408fdd98fb21 100644 (file)
@@ -2877,7 +2877,7 @@ packRegsForAccUse2 (iCode * ic)
             D (D_ACCUSE2_VERBOSE, ("  ! Preserves A, so continue scanning\n"));
             scan = next;
           }
-        else if (scan->next == NULL && bitVectnBitsOn (uses) == 1 && next != NULL)
+        /*else if (scan->next == NULL && bitVectnBitsOn (uses) == 1 && next != NULL)
           {
             if (next->prev == NULL)
               {
@@ -2894,7 +2894,7 @@ packRegsForAccUse2 (iCode * ic)
                 D (D_ACCUSE2, ("  + Dropping as last in list and next doesn't start a block\n"));
                 return;
               }
-          }
+          } /*This caused bug #1292721 */
         else if (scan->next == NULL)
           {
             D (D_ACCUSE2, ("  + Dropping as hit the end of the list\n"));
diff --git a/support/regression/tests/bug-1292721.c b/support/regression/tests/bug-1292721.c
new file mode 100644 (file)
index 0000000..5623c52
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+        bugs 1292721.
+*/
+
+#include <testfwk.h>
+
+char bar(void)
+{
+  static char ret = 0;
+  if(!ret) {
+    ret = 1;
+    return(0);
+  }
+  return(1);
+}
+
+void
+testBug156270(void)
+{
+  char aa, bb;
+
+  aa = bar();
+
+  for (;;) {
+
+    bb = bar();
+
+    if (!bb)
+      break;
+    
+    if (aa == 0)
+      return;
+
+    ASSERT(0);
+  }
+  ASSERT(0);
+}
+