Hi,
On 12/2/25 11:55 AM, Martin Jambor wrote:
@@ -697,6 +698,9 @@ cgraph_node::create_virtual_clone (const vec<cgraph_edge *>
&redirect_callers,
??? We cannot use COMDAT linkage because there is no
ABI support for this. */
set_new_clone_decl_and_node_flags (new_node);
+ if (has_callback_call)
+ /* Callback clone can never be local, since it has its address taken. */
+ new_node->local = false;
But over here we are basically setting the flag once again after it was
already set by the code you added in the first hunk because
set_new_clone_decl_and_node_flags cleared it, right?
Not entirely, the first hunk doesn't affect it, as mark_address_taken
doesn't touch the local flag at all. It needs to be set to 0 here
because the clone is initialized with local set to 1.
I think the better solution is to change
set_new_clone_decl_and_node_flags to look if there are any references to
the new node (IIUC there should be, cgraph_edge::redirect_callee already
helpfully creates them) and if so, set the flag rather than clear it.
That wouldn't be sufficient. In this code path, local is always set to
1 (initialized in cgraph_node::create_clone), but that is not the case
in other uses of the function. We can't really count on it being a
certain value, so the flag has to be set explicitly with something like
new_node->local = !new_node->referred_to_p (). I'll send the patch.
Thanks,
Martin
Josef