commit 57b5eebf19d3c1de5d7ebde4722c5bbabf17f395
parent ebd1bfd80b0716ec72b256c6b65c01e9f8d8e2f1
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 7 Jan 2016 23:15:51 +0100
Convert chkternary() o use the new fields in type
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cc1/expr.c b/cc1/expr.c
@@ -147,7 +147,7 @@ chkternary(Node *yes, Node *no)
if (yes->type->integer && cmpnode(yes, 0))
yes = convert(yes, no->type, 0);
if (no->type->integer && cmpnode(no, 0))
- no = convert(no, no->type, 0);
+ no = convert(no, yes->type, 0);
if (yes->type->op != PTR || no->type->op != PTR)
goto wrong_type;
@@ -161,7 +161,7 @@ chkternary(Node *yes, Node *no)
goto wrong_type;
}
}
- return node(OCOLON, yes->type, yes, yes);
+ return node(OCOLON, yes->type, yes, no);
wrong_type:
errorp("type mismatch in conditional expression");