shithub: scc

Download patch

ref: 5f038fa5f700d646549f1561cabb9c2e221498ad
parent: 2715d0eda708c570f3af021729242ffb2cea859c
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Apr 20 05:11:58 EDT 2014

Fix typeconv

--- a/expr.c
+++ b/expr.c
@@ -42,17 +42,17 @@
 {
 	Type *tp1, *tp2;
 	Node *np1 = *p1, *np2 = *p2;
-	uint8_t r1, r2;
+	uint8_t n;
 
 	np1 = promote(np1);
 	np2 = promote(np2);
 
 	tp1 = np1->utype;
-	tp2 = np1->utype;
+	tp2 = np2->utype;
 	if (tp1 != tp2) {
-		if (r1 > r2)
+		if ((n = tp1->u.rank - tp2->u.rank) > 0)
 			np2 = castcode(np2, tp1);
-		else if (r1 < r2)
+		else if (n < 0)
 			np1 = castcode(np1, tp2);
 	}
 	*p1 = np1;
--