https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771

--- Comment #25 from Hongtao.liu <crazylht at gmail dot com> ---
in fold_unary_loc
---cut from fold-const.cc-----
 9276      else if (TREE_CODE (arg0) == COND_EXPR)
 9277        {
 9278          tree arg01 = TREE_OPERAND (arg0, 1);
 9279          tree arg02 = TREE_OPERAND (arg0, 2);
 9280          if (! VOID_TYPE_P (TREE_TYPE (arg01)))
 9281            arg01 = fold_build1_loc (loc, code, type,
 9282                                 fold_convert_loc (loc,
 9283                                                   TREE_TYPE (op0),
arg01));
 9284          if (! VOID_TYPE_P (TREE_TYPE (arg02)))
 9285            arg02 = fold_build1_loc (loc, code, type,
 9286                                 fold_convert_loc (loc,
 9287                                                   TREE_TYPE (op0),
arg02));
 9288=>        tem = fold_build3_loc (loc, COND_EXPR, type, TREE_OPERAND (arg0,
0),
 9289                             arg01, arg02);

-----------end---------------

gcc always tries to simplify (convert (cond (cmp a b) c d) ---- > (cond (cmp a
b) (convert c) (convert d)), exactly the opposite of what this case wants.

Reply via email to