commit 6fd6dfd8592bc08ea2e4b40893e3d57a44297f44
parent 02e6ceca3bbaed6ec4120852882e62e464084f01
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 20 Apr 2014 07:02:43 +0200
promote integer types in convert()
integer promotion is done only when no float operands are
implied.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/expr.c b/expr.c
@@ -48,8 +48,13 @@ typeconv(Node **p1, Node **p2)
tp2 = np1->utype;
if (tp1 == tp2)
return;
- new1 = new2 = NULL;
+ if (tp1->op == INT && tp2->op == INT) {
+ np1 = promote(np1);
+ np2 = promote(np2);
+ }
+
n = tp1->u.size - tp2->u.size;
+ new1 = new2 = NULL;
if (n > 0)
new2 = tp1;