Run fold_constants on comparison operands.

This is a bit of a workaround to ensure the operands have their types
setup correctly. Really, binary_expr needs to handle expression types
properly.

This fixes the bogus error for comparing the result of pointer subtraction
with an integer.
This commit is contained in:
Bill Currie 2013-06-27 09:24:56 +09:00
parent c13f2c2c23
commit b66cbeeb57

View file

@ -1626,6 +1626,10 @@ binary_expr (int op, expr_t *e1, expr_t *e2)
e1 = test_expr (e1);
e2 = test_expr (e2);
}
if (is_compare (op)) {
e1 = fold_constants (e1);
e2 = fold_constants (e2);
}
if (e1->type == ex_error)
return e1;