https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71308
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Ah, that must be mine :(. Fix: --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -3053,7 +3053,8 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) == void_type_node)) gimple_call_set_fntype (stmt, TREE_TYPE (fndecl)); /* If the call becomes noreturn, remove the lhs. */ - if (gimple_call_noreturn_p (stmt) + if (lhs + && gimple_call_noreturn_p (stmt) && (VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (stmt))) || should_remove_lhs_p (lhs))) {