[PATCH 1/2] symtab: also change RTL decl name

Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Thu Nov 17 08:02:19 GMT 2022


Hi Honza, Ping.
Regtests cleanly for c,fortran,c++,ada,d,go,lto,objc,obj-c++
Ok?
I'd need this for attribute target_clones for the Fortran FE.
thanks,

On Wed,  9 Nov 2022 20:02:24 +0100
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:

> We were changing the ASSEMBLER_NAME of the function decl
> but not the name in DECL_RTL which is used as the function name
> fnname in rest_of_handle_final(). This led to using the old, wrong name
> for the attribute target default function when using target_clones.
> 
> Bootstrapped and regtested cleanly on x86_64-unknown-linux
> for c,c++,fortran,lto.
> Ok for trunk?
> 
> gcc/ChangeLog:
> 
> 	* symtab.cc: Remove stray comment.
> 	(symbol_table::change_decl_assembler_name): Also update the
> 	name in DECL_RTL.
> 
> Cc: Jan Hubicka <hubicka@ucw.cz>
> ---
>  gcc/symtab.cc | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/symtab.cc b/gcc/symtab.cc
> index f2d96c0268b..2e20bf5fefc 100644
> --- a/gcc/symtab.cc
> +++ b/gcc/symtab.cc
> @@ -154,8 +154,6 @@ symbol_table::decl_assembler_name_equal (tree decl, const_tree asmname)
>  }
>  
>  
> -/* Returns nonzero if P1 and P2 are equal.  */
> -
>  /* Insert NODE to assembler name hash.  */
>  
>  void
> @@ -303,6 +301,10 @@ symbol_table::change_decl_assembler_name (tree decl, tree name)
>  	warning (0, "%qD renamed after being referenced in assembly", decl);
>  
>        SET_DECL_ASSEMBLER_NAME (decl, name);
> +      /* Set the new name in rtl.  */
> +      if (DECL_RTL_SET_P (decl))
> +	XSTR (XEXP (DECL_RTL (decl), 0), 0) = IDENTIFIER_POINTER (name);
> +
>        if (alias)
>  	{
>  	  IDENTIFIER_TRANSPARENT_ALIAS (name) = 1;



More information about the Fortran mailing list