shithub: scc

Download patch

ref: 38c7bd73ee1a5c394045ed17eea8661c4f8a6302
parent: e9ab93461d0e7e043fadda396748c509b2cad5d3
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Dec 27 10:51:23 EST 2017

[as] Only fold binary when both operands are immediate

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

--- a/as/expr.c
+++ b/as/expr.c
@@ -129,7 +129,7 @@
 	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;