shithub: scc

Download patch

ref: a142f2ed782fe618116e51495f9404740087f4a1
parent: 2fe852042893ad264f303ed805ae09be383f5dd7
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Jan 7 16:22:52 EST 2016

Convert pcompare() to use new fields of type

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -288,11 +288,16 @@
 	return castcode(np, newtp);
 }
 
+#define XCHG(lp, rp, np) (np = lp, lp = rp, rp = np)
+
 static Node *
 parithmetic(char op, Node *lp, Node *rp)
 {
 	Type *tp;
-	Node *size;
+	Node *size, *np;
+
+	if (lp->type->op != PTR)
+		XCHG(lp, rp, np);
 
 	tp = lp->type;
 	size = sizeofnode(tp->type);