This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I think the best route out of this hole is to pass an additional "tree arg_type" parameter to the fold_binary_op_with_conditional_arg function. At both call sites in fold, this is simply the value "TREE_TYPE (TREE_OPERAND (t, 0))", i.e. the unstripped type of the first operand.
Then inside the function itself we cast "arg", "true_value" and "false_value" to this "arg_type", before using them as operands to build a tree with code CODE and result type TYPE.
+ arg = fold_convert (arg_type, arg);
if (lhs == 0)
+ {
+ true_value = fold_convert (arg_type, true_value);
lhs = fold (cond_first_p ? build2 (code, type, true_value, arg)
: build2 (code, type, arg, true_value));
}
if (rhs == 0)
+ {
+ false_value = fold_convert (arg_type, false_value);
rhs = fold (cond_first_p ? build2 (code, type, false_value, arg)
: build2 (code, type, arg, false_value));
+ }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |