ref: b88cbb14faba53251ef025e788c69400ab17faec
parent: adeca5a4f37c9dde9cd0fcd5f5bbc026c23db82f
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 14 12:40:09 EDT 2015
Fix eval() and exp2cond() Eval() was checking only with logical operators, but it should check against relational operators to. Exp2cond() was not decaying pointers.
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -291,7 +291,7 @@
case FTN:
np = decay(np);
}
- if (np->op != OAND && np->op != OOR)
+ if (!isnodecmp(np->op))
return np;
p = node(OCOLON, inttype, constnode(one), constnode(zero));
return node(OASK, inttype, np, p);
@@ -562,6 +562,11 @@
static Node *
exp2cond(Node *np, char neg)
{
+ switch (BTYPE(np)) {
+ case ARY:
+ case FTN:
+ np = decay(np);
+ }
if (isnodecmp(np->op))
return (neg) ? negate(np) : np;
return compare(ONE ^ neg, np, constnode(zero));