dwarf2 bugfix

Jeffrey A Law law@cygnus.com
Wed Nov 10 14:56:00 GMT 1999


The PA64 ABI has an argument pointer that resides in a non-fixed register.

In such cases GCC will arrange to copy the incoming argument pointer into
a pseudo register at the start of a function (the resulting pseudo is
often called the internal argument pointer).

DECL_INCOMING_RTL of a PARM_DECL will reference the internal argument pointer.

When optimizing it may be the case that all references to the internal
argument pointer will be deleted from the insn chain.  However, references to
the internal argument pointer may remain in DECL_INCOMING_RTL for parameters
which are passed on the stack.

This causes dwarf2 to emit "internal regno botch" messages.

For the PA64 port we can expose the bug by compiling this program with -O2 -g.

eelf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
                              input_section, contents, value,
                              info, sym_sec, h)
     char  *rel;
     char *input_bfd;
     char *output_bfd;
     char *input_section;
     char *contents;
     long value;
     char *info;
     char *sym_sec;
     char *h;
{
}

All references to the internal arg pointer are dead code and deleted; however,
a reference to the internal arg pointer is still in DECL_INCOMING_RTL (h).

This patch fixes the problem.

	* dwarf2out.c (add_AT_location_description): Allow
	(mem (plus (pseudo) (...)) too.
	
Index: dwarf2out.c
===================================================================
RCS file: /cvs/cvsfiles/devo//gcc/dwarf2out.c,v
retrieving revision 1.118
diff -c -3 -p -r1.118 dwarf2out.c
*** dwarf2out.c	1999/09/12 18:35:19	1.118
--- dwarf2out.c	1999/11/10 22:53:42
*************** add_AT_location_description (die, attr_k
*** 6938,6943 ****
--- 6938,6950 ----
    if (is_pseudo_reg (rtl)
        || (GET_CODE (rtl) == MEM
  	  && is_pseudo_reg (XEXP (rtl, 0)))
+       /* This can happen for a PARM_DECL with a DECL_INCOMING_RTL which 
+ 	 references the internal argument pointer (a pseudo) in a function
+ 	 where all references to the internal argument pointer were
+ 	 eliminated via the optimizers.  */
+       || (GET_CODE (rtl) == MEM
+ 	  && GET_CODE (XEXP (rtl, 0)) == PLUS
+ 	  && is_pseudo_reg (XEXP (XEXP (rtl, 0), 0)))
        || (GET_CODE (rtl) == CONCAT
  	  && is_pseudo_reg (XEXP (rtl, 0))
  	  && is_pseudo_reg (XEXP (rtl, 1))))






More information about the Gcc-patches mailing list