commit 57b5eebf19d3c1de5d7ebde4722c5bbabf17f395
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Thu Jan 7 23:15:51 2016 +0100
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Fri Jan 8 11:16:17 2016 +0100

    Convert chkternary() o use the new fields in type

diff --git a/cc1/expr.c b/cc1/expr.c
index f211e39..7909096 100644
--- 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");

Reply via email to