Fix glibc builds

Jan Hubicka jh@suse.cz
Sun Nov 16 00:00:00 GMT 2003


> > Bootstrapped/regtested i386
> 
> Sure? It introduced
> 
> FAIL: gcc.dg/attr-invalid.c (test for excess errors)

Actually it introduce new warning about symbol being renamed.  I
originally thought that the warning is correct as the testcase does
renaming and wanted to fix the testcase but forgot about it.

On deeper look I found that the warning is confused by hack in C
frontend:

  /* If the DECL_ASSEMBLER_NAME is not the same as the DECL_NAME, then
     either we already created RTL for this DECL (and since it was a
     local variable, its DECL_ASSEMBLER_NAME got hacked up to prevent
     clashes with other local statics with the same name by a previous
     call to make_decl_rtl), or the user explicitly requested a
     particular assembly name for this variable, using the GNU
     extension for this purpose:

       int i asm ("j");

     There's no way to know which case we're in, here.  But, it turns
     out we're safe.  If there's already RTL, then
     rest_of_decl_compilation ignores the ASMSPEC parameter, so we
     may as well not pass it in.  If there isn't RTL, then we didn't
     already create RTL, which means that the modification to
     DECL_ASSEMBLER_NAME came only via the explicit extension.  */
  if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl)
      && !DECL_RTL_SET_P (decl))

I am testing the attached patch to silence warning and will commit it if
it passes.

2003-11-16  Jan Hubicka  <jh@suse.cz>
	* cgraph.c (change_decl_assembler_name): Avoid bogus warnings.
Index: cgraph.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 cgraph.c
*** cgraph.c	13 Nov 2003 02:07:52 -0000	1.36
--- cgraph.c	15 Nov 2003 23:31:59 -0000
*************** change_decl_assembler_name (tree decl, t
*** 458,464 ****
    if (name == DECL_ASSEMBLER_NAME (decl))
      return;
  
!   if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
      warning ("%D renamed after being referenced in assembly", decl);
  
    if (TREE_CODE (decl) == FUNCTION_DECL && cgraph_hash)
--- 458,465 ----
    if (name == DECL_ASSEMBLER_NAME (decl))
      return;
  
!   if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
!       && DECL_RTL_SET_P (decl))
      warning ("%D renamed after being referenced in assembly", decl);
  
    if (TREE_CODE (decl) == FUNCTION_DECL && cgraph_hash)



More information about the Gcc-patches mailing list