From ea5b38935a17af38a328c8013e7eaf3c8de7ba09 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 5 Sep 2017 13:15:30 +0100 Subject: 41641: Some math operations shouldn't be lvalues. This includes pre- and post- increment and decrement. Simply mark all values after operations as rvalues. --- Src/math.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'Src/math.c') diff --git a/Src/math.c b/Src/math.c index f9613001a..c3831602b 100644 --- a/Src/math.c +++ b/Src/math.c @@ -1306,8 +1306,6 @@ op(int what) spval->type = MN_INTEGER; } else spval->u.l = !spval->u.l; - stack[sp].lval = NULL; - stack[sp].pval = NULL; break; case COMP: if (spval->type & MN_FLOAT) { @@ -1315,8 +1313,6 @@ op(int what) spval->type = MN_INTEGER; } else spval->u.l = ~spval->u.l; - stack[sp].lval = NULL; - stack[sp].pval = NULL; break; case POSTPLUS: a = *spval; @@ -1335,16 +1331,12 @@ op(int what) (void)setmathvar(stack + sp, a); break; case UPLUS: - stack[sp].lval = NULL; - stack[sp].pval = NULL; break; case UMINUS: if (spval->type & MN_FLOAT) spval->u.d = -spval->u.d; else spval->u.l = -spval->u.l; - stack[sp].lval = NULL; - stack[sp].pval = NULL; break; case QUEST: DPUTS(sp < 2, "BUG: math: three shall be the number of the counting."); @@ -1377,6 +1369,8 @@ op(int what) zerr("bad math expression: out of integers"); return; } + stack[sp].lval = NULL; + stack[sp].pval = NULL; } -- cgit 1.4.1