https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110055
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- The clobber is built by gimplify_target_expr and TARGET_EXPR_SLOT is changed in place to the static variable. Does the following fix the RISC-V issue? diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index ade6e335da7..aece89a3e9b 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -7154,8 +7154,10 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) gimplify_and_add (init, &init_pre_p); /* Add a clobber for the temporary going out of scope, like - gimplify_bind_expr. */ + gimplify_bind_expr. But only if we did not promote the + temporary to static storage. */ if (gimplify_ctxp->in_cleanup_point_expr + && !TREE_STATIC (temp) && needs_to_live_in_memory (temp)) { if (flag_stack_reuse == SR_ALL)