keith@motel6.UUCP (Keith Packard) (03/19/86)
I thought this program was too simple to have bugs! Alas I was mistaken. The following is a segment of the file expr.c, toward the end of the routine eeval. The changed lines are marked with '!' marks. Keith Packard ...!tektronix!reed!motel6!keith -----------------------------------start of fix--------------------- case INC: if (f->e_left == 0) { s = f->e_right->e_name; switch (s->s_type) { case UNDEF: s->s_type = VARTYPE; case VARTYPE: r = s->s_value; s->s_value += 1; break; case STACKTYPE: r = framep[s->s_offset]; framep[s->s_offset] += 1; } return r; } else { ! s = f->e_left->e_name; switch (s->s_type) { case UNDEF: s->s_type = VARTYPE; case VARTYPE: return (s->s_value += 1); case STACKTYPE: return (framep[s->s_offset] += 1); } } case DEC: if (f->e_left == 0) { s = f->e_right->e_name; switch (s->s_type) { case UNDEF: s->s_type = VARTYPE; case VARTYPE: r = s->s_value; s->s_value -= 1.0; break; case STACKTYPE: r = framep[s->s_offset]; framep[s->s_offset] -= 1.0; } return r; } else { ! s = f->e_left->e_name; switch (s->s_type) { case UNDEF: s->s_type = VARTYPE; case VARTYPE: return (s->s_value -= 1.0); case STACKTYPE: return (framep[s->s_offset] -= 1.0); } } ----------------------------------end of fix---------------------------------