[Bug ipa/106816] noreturn/pure attributes are not set correctly on multiversioned functions

jamborm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 3 10:27:10 GMT 2023


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

--- Comment #9 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #6)
> 
> @Martin: Do we have a declaration cloning code for functions somewhere?

See e.g. cgraph_node::create_virtual_clone in cgraphclones.cc.  Unless
you want to mess with the parameters,

  new_decl = copy_node (old_decl);

should be enough (and it should copy over the DECL_PURE and
TREE_READLONY bit soo, I believe).

I am not sure at what point the duplication happens, in order to
duplicate also all the various IPA summaries, cgraph machinery has to
be involved and call all the summary hooks.  So
cgraph_node::create_clone should probably be used (or a part of it, or
perhaps even one of its users?).


More information about the Gcc-bugs mailing list