simple C compiler
git clone git://
Log | Files | Refs | README | LICENSE

commit f2149706330f6585b2013e680e0ea15f1abdeb73
parent f0bad0d420fc126fa86c3e8a95f1783cc7032ed6
Author: Roberto E. Vargas Caballero <>
Date:   Sat, 12 Apr 2014 08:50:23 +0200

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.

Mexpr.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/expr.c b/expr.c @@ -86,8 +86,8 @@ arithmetic(char op, Node *np1, Node *np2) 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 @@ arithmetic(char op, Node *np1, Node *np2) floatconv(&np1, &np2); break; case INT: -int_float: np2 = castcode(np2, np1->type); break; default: