shithub: scc

Download patch

ref: c65ba1f014232a19cd2b4d27f1a06dc18b9c4c2d
parent: ffbd94a13592c386a30ba1c8e09364c7c003cdb2
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Sep 4 15:57:05 EDT 2015

Remove eval()

This function was added to transform comparision or logic
expressions in arithmetic expressions using ternary
operations. This transformation is needed in a z80,
but not in a amd64, and it makes difficult to apply
algebraic transformations.

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -284,12 +284,13 @@
 static Node *
 compare(char op, Node *lp, Node *rp)
 {
-	lp = promote(decay(lp));
-	rp = promote(decay(rp));
+	lp = decay(lp);
+	rp = decay(rp);
+
 	switch (BTYPE(lp)) {
 	case INT:
 	case FLOAT:
-		switch (BTYPE(lp)) {
+		switch (BTYPE(rp)) {
 		case INT:
 		case FLOAT:
 			typeconv(&lp, &rp);