https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80032
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- The patch causes some optimization regressions. A different approach is to put the clobbers in non-conditional context - something that is valid but with the clobber semantic cannot be done by the middle-end. Instead we can do this at gimplification time with, say, Index: gcc/gimplify.c =================================================================== --- gcc/gimplify.c (revision 246216) +++ gcc/gimplify.c (working copy) @@ -6288,10 +6288,13 @@ gimplify_cleanup_point_expr (tree *expr_ /* Insert a cleanup marker for gimplify_cleanup_point_expr. CLEANUP is the cleanup action required. EH_ONLY is true if the cleanup should - only be executed if an exception is thrown, not on normal exit. */ + only be executed if an exception is thrown, not on normal exit. + If FORCE_UNCOND is true perform the cleanup unconditionally; this is + only valid for clobbers. */ static void -gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p) +gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p, + bool force_uncond = false) { gimple *wce; gimple_seq cleanup_stmts = NULL; @@ -6301,7 +6304,8 @@ gimple_push_cleanup (tree var, tree clea if (seen_error ()) return; - if (gimple_conditional_context ()) + if (gimple_conditional_context () + && ! force_uncond) { /* If we're in a conditional context, this is more complex. We only want to run the cleanup if we actually ran the initialization that @@ -6426,11 +6430,7 @@ gimplify_target_expr (tree *expr_p, gimp NULL); TREE_THIS_VOLATILE (clobber) = true; clobber = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, clobber); - if (cleanup) - cleanup = build2 (COMPOUND_EXPR, void_type_node, cleanup, - clobber); - else - cleanup = clobber; + gimple_push_cleanup (temp, clobber, false, pre_p, true); } if (asan_poisoned_variables && dbg_cnt (asan_use_after_scope)) { which brings down stack usage to GCC 5 levels (so is even better than the other patch).