public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Question about a varasm change
@ 2000-09-15  3:25 Bernd Schmidt
  2000-09-18  0:24 ` Jason Merrill
  0 siblings, 1 reply; 7+ messages in thread
From: Bernd Schmidt @ 2000-09-15  3:25 UTC (permalink / raw)
  To: jason; +Cc: gcc

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);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about a varasm change
  2000-09-15  3:25 Question about a varasm change Bernd Schmidt
@ 2000-09-18  0:24 ` Jason Merrill
  2000-09-18  2:32   ` Bernd Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Merrill @ 2000-09-18  0:24 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: gcc, jason

The change fixes DECL_ASSEMBLER_NAME so that it actually corresponds to the
name used in assembler output, as documented.  If the stabs backend expects
it to be the unmangled name from the source, it's looking in the wrong
place; that's what DECL_NAME is for.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about a varasm change
  2000-09-18  0:24 ` Jason Merrill
@ 2000-09-18  2:32   ` Bernd Schmidt
  2000-09-18  8:34     ` Jeffrey A Law
  0 siblings, 1 reply; 7+ messages in thread
From: Bernd Schmidt @ 2000-09-18  2:32 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc, gcc-patches

On 18 Sep 2000, Jason Merrill wrote:

> The change fixes DECL_ASSEMBLER_NAME so that it actually corresponds to the
> name used in assembler output, as documented.  If the stabs backend expects
> it to be the unmangled name from the source, it's looking in the wrong
> place; that's what DECL_NAME is for.

Thanks.  Is this patch OK?  It fixes a bunch of gdb failures.


Bernd

	* dbxout.c (dbxout_symbol_name): Use DECL_NAME rather than
	DECL_ASSEMBLER_NAME.

Index: dbxout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dbxout.c,v
retrieving revision 1.60
diff -u -p -r1.60 dbxout.c
--- dbxout.c	2000/07/23 17:53:21	1.60
+++ dbxout.c	2000/09/18 09:31:12
@@ -2219,7 +2219,7 @@ dbxout_symbol_name (decl, suffix, letter
      class member, we must put out the mangled name instead of the
      DECL_NAME.  Note also that static member (variable) names DO NOT begin
      with underscores in .stabs directives.  */
-  const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+  const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
   if (name == 0)
     name = "(anon)";
   fprintf (asmfile, "%s \"%s%s:", ASM_STABS_OP, name,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about a varasm change
  2000-09-18  2:32   ` Bernd Schmidt
@ 2000-09-18  8:34     ` Jeffrey A Law
  2000-09-19  8:34       ` Bernd Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Jeffrey A Law @ 2000-09-18  8:34 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Jason Merrill, gcc, gcc-patches

  In message < Pine.LNX.4.21.0009181031180.1440-100000@mahatma.cygnus.co.uk >you 
write:
  > On 18 Sep 2000, Jason Merrill wrote:
  > 
  > > The change fixes DECL_ASSEMBLER_NAME so that it actually corresponds to t
  > he
  > > name used in assembler output, as documented.  If the stabs backend expec
  > ts
  > > it to be the unmangled name from the source, it's looking in the wrong
  > > place; that's what DECL_NAME is for.
  > 
  > Thanks.  Is this patch OK?  It fixes a bunch of gdb failures.
  > 
  > 
  > Bernd
  > 
  > 	* dbxout.c (dbxout_symbol_name): Use DECL_NAME rather than
  > 	DECL_ASSEMBLER_NAME.
Err, don't you need to use DECL_ASSEMBLER_NAME if the decl is a 
static class member?  According to the comment in that case we want the
mangled name.

jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about a varasm change
  2000-09-18  8:34     ` Jeffrey A Law
@ 2000-09-19  8:34       ` Bernd Schmidt
  2000-09-21 14:28         ` Jason Merrill
  0 siblings, 1 reply; 7+ messages in thread
From: Bernd Schmidt @ 2000-09-19  8:34 UTC (permalink / raw)
  To: Jeffrey A Law; +Cc: Jason Merrill, gcc, gcc-patches

On Mon, 18 Sep 2000, Jeffrey A Law wrote:

>   > 	* dbxout.c (dbxout_symbol_name): Use DECL_NAME rather than
>   > 	DECL_ASSEMBLER_NAME.
> Err, don't you need to use DECL_ASSEMBLER_NAME if the decl is a 
> static class member?  According to the comment in that case we want the
> mangled name.

To be honest I have no idea.  I just followed what Jason suggested.


Bernd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about a varasm change
  2000-09-19  8:34       ` Bernd Schmidt
@ 2000-09-21 14:28         ` Jason Merrill
  2000-09-22 10:56           ` Jason Merrill
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Merrill @ 2000-09-21 14:28 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Jeffrey A Law, gcc, gcc-patches

I'll check in a fix RSN.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about a varasm change
  2000-09-21 14:28         ` Jason Merrill
@ 2000-09-22 10:56           ` Jason Merrill
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Merrill @ 2000-09-22 10:56 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: Jeffrey A Law, gcc, gcc-patches

I'm checking this in:

2000-09-22  Jason Merrill  <jason@redhat.com>

	* dbxout.c (dbxout_symbol_name): Just use DECL_NAME for
	function-local names.

Index: dbxout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dbxout.c,v
retrieving revision 1.60
diff -c -p -r1.60 dbxout.c
*** dbxout.c	2000/07/23 17:53:21	1.60
--- dbxout.c	2000/09/22 17:52:45
*************** dbxout_symbol_name (decl, suffix, letter
*** 2215,2225 ****
       const char *suffix;
       int letter;
  {
!   /* One slight hitch: if this is a VAR_DECL which is a static
!      class member, we must put out the mangled name instead of the
!      DECL_NAME.  Note also that static member (variable) names DO NOT begin
!      with underscores in .stabs directives.  */
!   const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
    if (name == 0)
      name = "(anon)";
    fprintf (asmfile, "%s \"%s%s:", ASM_STABS_OP, name,
--- 2215,2233 ----
       const char *suffix;
       int letter;
  {
!   const char *name;
! 
!   if (TYPE_P (DECL_CONTEXT (decl)))
!     /* One slight hitch: if this is a VAR_DECL which is a static
!        class member, we must put out the mangled name instead of the
!        DECL_NAME.  Note also that static member (variable) names DO NOT begin
!        with underscores in .stabs directives.  */
!     name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
!   else
!     /* ...but if we're function-local, we don't want to include the junk
!        added by ASM_FORMAT_PRIVATE_NAME.  */
!     name = IDENTIFIER_POINTER (DECL_NAME (decl));
! 
    if (name == 0)
      name = "(anon)";
    fprintf (asmfile, "%s \"%s%s:", ASM_STABS_OP, name,

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-09-22 10:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-15  3:25 Question about a varasm change Bernd Schmidt
2000-09-18  0:24 ` Jason Merrill
2000-09-18  2:32   ` Bernd Schmidt
2000-09-18  8:34     ` Jeffrey A Law
2000-09-19  8:34       ` Bernd Schmidt
2000-09-21 14:28         ` Jason Merrill
2000-09-22 10:56           ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).