scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 5fb67b526f1697729473a560d383d7ef1cdae75e
parent 5617bd05cbe804de5fcd9caed04088ca219becf5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 27 Dec 2017 15:51:23 +0000

[as] Only fold binary when both operands are immediate

The condition was wrong because it must be and && instead of a ||.

Diffstat:
Mas/expr.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/as/expr.c b/as/expr.c @@ -129,7 +129,7 @@ binary(int op, Node *l, Node *r) int addr; Node *np; - if (l->op == NUMBER || r->op == NUMBER) + if (l->op == NUMBER && r->op == NUMBER) return fold(op, l, r); if (l->addr == AIMM && r->addr == AIMM) addr = AIMM;