git: 9front

Download patch

ref: dca3098f336168d022ed835e74f6d064366035e9
parent: 5c5cf11ef828ed6bcba7e40af0a3c02cbce5b8cc
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) {
--