die = ffecom_call_gfrt (FFECOM_gfrtRANGE,
args, NULL_TREE);
TREE_SIDE_EFFECTS (die) = 1;
+ die = convert (void_type_node, die);
element = ffecom_3 (COND_EXPR,
TREE_TYPE (element),
return ffe_truthvalue_conversion (TREE_OPERAND (expr, 0));
case COND_EXPR:
- /* Distribute the conversion into the arms of a COND_EXPR. */
- return fold (build (COND_EXPR, integer_type_node, TREE_OPERAND (expr, 0),
- ffe_truthvalue_conversion (TREE_OPERAND (expr, 1)),
- ffe_truthvalue_conversion (TREE_OPERAND (expr, 2))));
+ {
+ /* Distribute the conversion into the arms of a COND_EXPR. */
+ tree arg1 = TREE_OPERAND (expr, 1);
+ tree arg2 = TREE_OPERAND (expr, 2);
+ if (! VOID_TYPE_P (TREE_TYPE (arg1)))
+ arg1 = ffe_truthvalue_conversion (arg1);
+ if (! VOID_TYPE_P (TREE_TYPE (arg2)))
+ arg2 = ffe_truthvalue_conversion (arg2);
+ return fold (build (COND_EXPR, integer_type_node,
+ TREE_OPERAND (expr, 0), arg1, arg2));
+ }
case CONVERT_EXPR:
/* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
we simply build `a, throw 3'. */
if (VOID_TYPE_P (TREE_TYPE (true_value)))
{
- lhs_code = COMPOUND_EXPR;
- if (!cond_first_p)
- lhs_type = void_type_node;
+ if (! cond_first_p)
+ {
+ lhs_code = COMPOUND_EXPR;
+ lhs_type = void_type_node;
+ }
+ else
+ lhs = true_value;
}
if (VOID_TYPE_P (TREE_TYPE (false_value)))
{
- rhs_code = COMPOUND_EXPR;
- if (!cond_first_p)
- rhs_type = void_type_node;
+ if (! cond_first_p)
+ {
+ rhs_code = COMPOUND_EXPR;
+ rhs_type = void_type_node;
+ }
+ else
+ rhs = false_value;
}
}
else
if (TREE_CODE (arg) == SAVE_EXPR)
save = 1;
- else if (!TREE_CONSTANT (arg)
+ else if (lhs == 0 && rhs == 0
+ && !TREE_CONSTANT (arg)
&& (*lang_hooks.decls.global_bindings_p) () == 0
&& ((TREE_CODE (arg) != VAR_DECL && TREE_CODE (arg) != PARM_DECL)
|| TREE_SIDE_EFFECTS (arg)))
fold (build1 (code, type, TREE_OPERAND (arg0, 1))));
else if (TREE_CODE (arg0) == COND_EXPR)
{
+ tree arg01 = TREE_OPERAND (arg0, 1);
+ tree arg02 = TREE_OPERAND (arg0, 2);
+ if (! VOID_TYPE_P (TREE_TYPE (arg01)))
+ arg01 = fold (build1 (code, type, arg01));
+ if (! VOID_TYPE_P (TREE_TYPE (arg02)))
+ arg02 = fold (build1 (code, type, arg02));
t = fold (build (COND_EXPR, type, TREE_OPERAND (arg0, 0),
- fold (build1 (code, type, TREE_OPERAND (arg0, 1))),
- fold (build1 (code, type, TREE_OPERAND (arg0, 2)))));
+ arg01, arg02));
/* If this was a conversion, and all we did was to move into
inside the COND_EXPR, bring it back out. But leave it if
&& TREE_CODE (t) == COND_EXPR
&& TREE_CODE (TREE_OPERAND (t, 1)) == code
&& TREE_CODE (TREE_OPERAND (t, 2)) == code
+ && ! VOID_TYPE_P (TREE_OPERAND (t, 1))
+ && ! VOID_TYPE_P (TREE_OPERAND (t, 2))
&& (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0))
== TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 2), 0)))
&& ! (INTEGRAL_TYPE_P (TREE_TYPE (t))