https://gcc.gnu.org/g:05e4bb882979e94e0c675e771d90f94f1315e6d6

commit r16-2640-g05e4bb882979e94e0c675e771d90f94f1315e6d6
Author: Jan Hubicka <j...@suse.cz>
Date:   Wed Jul 30 14:48:43 2025 +0200

    Fix symbol_table::change_decl_assembler_name when DECL_RTL is already 
computed
    
    while working on patch assigning unique names to static symbols I noticed 
that
    fortran symbols are not renamed since the frontend calls make_decl_rtl.  
This
    gets DECL_ASSEMBBLER_NAME and DECL_RTL out of sync. I think we can drop that
    call, but it is also good idea to avoid this inconsistence, so this patch 
makes
    symbol_table::change_decl_assembler_name to recompute DECL_RTL in this case.
    
    gcc/ChangeLog:
    
            * symtab.cc (symbol_table::change_decl_assembler_name): Recompute 
DECL_RTL
            in case it is already computed.

Diff:
---
 gcc/symtab.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index 652f66a5d2f8..20dfe09ec2fe 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -303,6 +303,11 @@ 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);
+      if (DECL_RTL_SET_P (decl))
+       {
+         SET_DECL_RTL (decl, NULL);
+         make_decl_rtl (decl);
+       }
       if (alias)
        {
          gcc_assert (!IDENTIFIER_INTERNAL_P (name));

Reply via email to