This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Question about a varasm change


I have a question about the patch below which was applied in March.  It
appears to be causing us to generate incorrect debugging information with
static local variables in C.  The following testcase is from Fred Fish:

  void foo ()
  {
    static int funclocal = 101;
  }

The correct output is supposed to be

  .stabs "funclocal:V1",38,0,3,funclocal.3

while the current compiler produces

  .stabs "funclocal.0:V1",38,0,3,funclocal.0

The code in dbxout_symbol_name uses DECL_ASSEMBLER_NAME to print the first
string.  DECL_ASSEMBLER_NAME has the correct value ("funclocal") in the
beginning when it's created by build_decl, but it gets overwritten with
"funclocal.0" in make_decl_rtl with the change below installed.

What does the change accomplish, and do you have an idea how to fix this
problem?


Bernd

2000-03-03  Jason Merrill  <jason@casey.cygnus.com>

        * varasm.c (make_function_rtl): If we change the name used in the
	rtl, update DECL_ASSEMBLER_NAME accordingly.
	(make_decl_rtl): Likewise.

Index: varasm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/varasm.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -p -r1.101 -r1.102
--- varasm.c	2000/03/02 23:30:38	1.101
+++ varasm.c	2000/03/04 00:48:46	1.102
@@ -553,6 +553,7 @@ make_function_rtl (decl)
 
   if (DECL_RTL (decl) == 0)
     {
+      DECL_ASSEMBLER_NAME (decl) = get_identifier (name);
       DECL_RTL (decl)
 	= gen_rtx_MEM (DECL_MODE (decl),
 		       gen_rtx_SYMBOL_REF (Pmode, name));
@@ -792,6 +793,7 @@ make_decl_rtl (decl, asmspec, top_level)
 	      name = new_name;
 	    }
 
+	  DECL_ASSEMBLER_NAME (decl) = get_identifier (name);
 	  DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
 					 gen_rtx_SYMBOL_REF (Pmode, name));
 	  MEM_ALIAS_SET (DECL_RTL (decl)) = get_alias_set (decl);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]