times, the loop-control-variable is not assigned to
-static char Version[] = "ACK Modula-2 compiler Version 0.41";
+static char Version[] = "ACK Modula-2 compiler Version 0.42";
case FOR:
{
arith tmp = NewInt();
- arith tmp2 = 0;
+ arith tmp2 = NewInt();
register t_node *fnd;
int good_forvar;
label l1 = ++text_label;
C_stl(tmp);
CodePExpr(left->nd_left);
C_dup(int_size);
- CodeDStore(nd);
+ C_stl(tmp2);
C_lol(tmp);
if (uns) C_cmu(int_size);
else C_cmi(int_size);
C_zgt(l2);
+ C_lol(tmp2);
+ CodeDStore(nd);
C_lol(tmp);
ForLoopVarExpr(nd);
if (left->nd_INT >= 0) {
nd->nd_def->df_flags |= D_FORLOOP;
def_ilb(l1);
if (! options['R']) {
- tmp2 = NewInt();
ForLoopVarExpr(nd);
C_stl(tmp2);
}
WalkNode(right, exit_label);
nd->nd_def->df_flags &= ~D_FORLOOP;
- if (tmp2 != 0) {
+ if (! options['R']) {
label x = ++text_label;
C_lol(tmp2);
ForLoopVarExpr(nd);
c_loc(M2_FORCH);
C_trp();
def_ilb(x);
- FreeInt(tmp2);
}
+ FreeInt(tmp2);
if (stepsize) {
C_lol(tmp);
C_zeq(l2);