mpreduce: Debug decomposition corrupts initial state for code generator.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 4 Apr 2006 16:17:30 +0000 (17:17 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 4 Apr 2006 16:17:30 +0000 (17:17 +0100)
The code generation pass uses whatever final state the debugging run
left behind.  Have the debug pass force the final state back to Z when
it finishes.

Also, produce correct output from the debugging pass.

mpreduce.c

index 0f20ed8..52e86a1 100644 (file)
@@ -101,7 +101,8 @@ int mpreduce_create(mpreduce *r, mp *p)
       case X0 | 0: st =  Z; printf("+ %lu\n", i - 1); break;
     }
   }
-  if (st >= X) printf("+ %lu\n", i);
+  if (st >= X) printf("+ %lu\n", i - 1);
+  st = Z;
 #endif
 
   for (i = 0, mp_scan(&sc, p); i < d  - 1 && mp_step(&sc); i++) {