shithub: scc

Download patch

ref: f2149706330f6585b2013e680e0ea15f1abdeb73
parent: f0bad0d420fc126fa86c3e8a95f1783cc7032ed6
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Apr 12 04:50:23 EDT 2014

Don't swap integer float operands

The swap was done due to pointers, because in that
case there are too much cases, and we didn't want to
replicate the effort in cases as PTR + INT or INT + PTR,
but it generates problems in cases as comparisions. This
is the first step, where we remove the swap only for int
and float types.

--- a/expr.c
+++ b/expr.c
@@ -86,8 +86,8 @@
 				intconv(&np1, &np2);
 			break;
 		case FLOAT:
-			SWAP(np1, np2, naux);
-			goto int_float;
+			np2 = castcode(np1, np2->type);
+			break;
 		case PTR: case ARY:
 			SWAP(np1, np2, naux);
 			SWAP(t1, t2, taux);
@@ -103,7 +103,6 @@
 				floatconv(&np1, &np2);
 			break;
 		case INT:
-int_float:
 			np2 = castcode(np2, np1->type);
 			break;
 		default: