* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Convert operand type when copying the operand to a variable of different type. Index: tree-ssa-loop-ivopts.c =================================================================== --- tree-ssa-loop-ivopts.c (revision 140668) +++ tree-ssa-loop-ivopts.c (working copy) @@ -5157,6 +5157,9 @@ rewrite_use_nonlinear_expr (struct ivopt if (gimple_code (use->stmt) == GIMPLE_PHI) { + if (TREE_TYPE (op) != TREE_TYPE (tgt)) + op = fold_convert (TREE_TYPE (tgt), op); + ass = gimple_build_assign (tgt, op); gsi_insert_before (&bsi, ass, GSI_SAME_STMT); remove_statement (use->stmt, false);