[hackers] [scc] Convert chkternary() o use the new fields in type || Roberto E. Vargas Caballero
commit 57b5eebf19d3c1de5d7ebde4722c5bbabf17f395
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jan 7 23:15:51 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
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
_AT_@ -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;
_AT_@ -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");
Received on Fri Jan 08 2016 - 13:13:59 CET
This archive was generated by hypermail 2.3.0
: Fri Jan 08 2016 - 13:25:00 CET