On 3/2/21 6:57 PM, Jason Merrill wrote: > On 3/2/21 5:34 AM, Martin Liška wrote: >> On 3/1/21 8:58 PM, Jason Merrill wrote: >>> On 3/1/21 11:59 AM, Martin Liška wrote: >>>> On 3/1/21 5:36 PM, Jason Merrill wrote: >>>>> On 3/1/21 7:43 AM, Martin Liška wrote: >>>>>> On 2/22/21 11:53 PM, Jason Merrill wrote: >>>>>>> The problem seems to be with the handling of local decls.  If DECL_LOCAL_DECL_P, you need to look at DECL_LOCAL_DECL_ALIAS to find the namespace-scope decl.  But then if there is no preceding namespace-scope declaration, the new decl created by push_local_extern_decl_alias doesn't have a cgraph node, either. I guess maybe_function_versions also needs to look through DECL_LOCAL_DECL_ALIAS. >>>>>> >>>>>> Ah, I see. Are you sure about the name 'maybe_function_versions'? I can't find it. >>>>> >>>>> Ah, it's maybe_version_functions, sorry. >>>> >>>> Thanks, I see the function now. >>>> So about your guess: >>>> >>>>> I guess maybe_function_versions also needs to look through DECL_LOCAL_DECL_ALIAS. >>>> >>>> Do you mean maybe_version_functions's argument 'record' should depend on DECL_LOCAL_DECL_ALIAS of newdecl/oldddecl >>>> (if present)? Or that DECL_FUNCTION_VERSIONED should be set for DECL_LOCAL_DECL_ALIASes of the newdecl/olddecl >>>> function declarations? >>> >>> The latter. >> >> I see, but will not help us. Problem is that >> #2  0x00000000015d8899 in ix86_get_function_versions_dispatcher (decl=0x7ffff7755000) at /home/marxin/Programming/gcc/gcc/config/i386/i386-features.c:2862 >> >> is called for a declaration for which >> >> Breakpoint 5, maybe_version_functions (newdecl=, olddecl=, record=false) at /home/marxin/Programming/gcc/gcc/cp/decl.c:1118 >> >> is called with record=false. So that cgraph_node is not created for it. >> >> Or is a possible solution that get_function_version_dispatcher should look through the DECL_LOCAL_DECL_ALIAS? > > Yes, I was thinking both that function and maybe_version_functions. > > Jason > All right, the following patch fixes that. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin