shithub: scc

Download patch

ref: c962f3371ac0e2919e9c8cebe51efc743398c15a
parent: b36ba5a483bd38626adcce0c3c217a0d9ead6ddf
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Apr 22 19:56:48 EDT 2016

[cc2-qbe] Add OADDR to QBE

OADDR is a nop in QBE, but we still have to transform the node in a
temporary node without creating a temporary symbol.

--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -258,7 +258,6 @@
 	case OBAND:
 	case OBOR:
 	case OBXOR:
-	case OCPL:
 	case OEQ:
 	case ONE:
 		off = 0;
@@ -285,15 +284,18 @@
 	case OELOOP:
 		return NULL;
 	case OCAST:
-		assert(r == NULL);
 		return cast(np, l);
-	case OPAR:
-	case ONEG:
 	case OADDR:
-		abort();
+		np->flags |= ISTMP;
+		np->op = OTMP;
+		np->u.sym = l->u.sym;
+		return np;
 	case OPTR:
 		np->left = load(load(l));
 		return tmpnode(np);
+	case OCPL:
+	case OPAR:
+	case ONEG:
 	case OINC:
 	case ODEC:
 		abort();