shithub: riscv

Download patch

ref: 3d0ebdc439039f1e01ee5fa0f75b1de1a12c12f1
parent: 6b22a732e80cfbb28db8d707d5938141abf63a79
author: spew <devnull@localhost>
date: Mon May 28 15:38:33 EDT 2018

6c, 8c: Fix nocast cast bug which prevents address arithmetic from being computed at compile time

--- a/sys/src/cmd/6c/sgen.c
+++ b/sys/src/cmd/6c/sgen.c
@@ -105,7 +105,8 @@
 	case OADD:
 		xcom(l);
 		xcom(r);
-		if(n->type->etype != TIND)
+		if(n->type->etype != TIND &&
+		   !(l->type->etype == TIND && r->type->etype == TIND))
 			break;
 
 		switch(r->addable) {
--- a/sys/src/cmd/8c/sgen.c
+++ b/sys/src/cmd/8c/sgen.c
@@ -112,7 +112,8 @@
 	case OADD:
 		xcom(l);
 		xcom(r);
-		if(n->type->etype != TIND)
+		if(n->type->etype != TIND &&
+		   !(l->type->etype == TIND && r->type->etype == TIND))
 			break;
 
 		switch(r->addable) {