This is the one with the folding fix... Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Richard. 2017-09-12 Richard Biener <rguent...@suse.de> PR middle-end/82128 * gimple-fold.c (gimple_fold_call): Update iterator properly. Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 252002) +++ gcc/gimple-fold.c (working copy) @@ -3872,7 +3872,7 @@ gimple_fold_call (gimple_stmt_iterator * we need to preserve GIMPLE_CALL statement at position of GSI iterator. */ update_call_from_tree (gsi, def); - gsi_insert_before (gsi, new_stmt, GSI_NEW_STMT); + gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); } else {