https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105554

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #16)
> Ick - that's one of the worst place to do this ... what happens if we
> postpone setting DECL_RESULT/DECL_ARGUMENTS to after initialize_cfun
> (and remove the setting of them there)?

If DECL_RESULT is NULL, then allocate_struct_function will segfault.
I think if DECL_ARGUMENTS was NULL there, it would be ok with it.

But initialize_cfun starts with:
  if (!DECL_ARGUMENTS (new_fndecl))
    DECL_ARGUMENTS (new_fndecl) = DECL_ARGUMENTS (callee_fndecl);
  if (!DECL_RESULT (new_fndecl))
    DECL_RESULT (new_fndecl) = DECL_RESULT (callee_fndecl);
which makes it redundant with the only caller of it doing:
  DECL_RESULT (new_decl) = DECL_RESULT (old_decl);
  DECL_ARGUMENTS (new_decl) = DECL_ARGUMENTS (old_decl);
  initialize_cfun (new_decl, old_decl,
                   new_entry ? new_entry->count : old_entry_block->count);

Reply via email to