scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 5f038fa5f700d646549f1561cabb9c2e221498ad
parent 2715d0eda708c570f3af021729242ffb2cea859c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 20 Apr 2014 09:11:58 +0200

Fix typeconv

Diffstat:
Mexpr.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/expr.c b/expr.c @@ -42,17 +42,17 @@ typeconv(Node **p1, Node **p2) { 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;