Patchwork Do framep replacement even on RHS outside of MEM contexts (PR debug/44694)

login
register
mail settings
Submitter Jakub Jelinek
Date July 1, 2010, 8:22 a.m.
Message ID <20100701082205.GT25077@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/57492/
State New
Headers show

Comments

Jakub Jelinek - July 1, 2010, 8:22 a.m.
On Thu, Jul 01, 2010 at 04:13:03PM +0800, Jie Zhang wrote:
> This patch caused ICE for arm-none-eabi target:
> 
> internal compiler error: in arm_dbx_register_number, at
> config/arm/arm.c:21155
> 
> when compiling thumb multilib libstdc++.

Richard Earnshaw has already reported this in the PR, and here is my fix for
that.  I don't have any arm boxes, so will just test it on x86_64-linux and
i686-linux (the PR44694 patch has been tested also on ppc/ppc64/s390/s390x
btw), could you please test it on arm?  Thanks.

2010-07-01  Jakub Jelinek  <jakub@redhat.com>

	PR debug/44694
	* dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
	or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.



	Jakub
Jie Zhang - July 1, 2010, 8:33 a.m.
On 07/01/2010 04:22 PM, Jakub Jelinek wrote:
> On Thu, Jul 01, 2010 at 04:13:03PM +0800, Jie Zhang wrote:
>> This patch caused ICE for arm-none-eabi target:
>>
>> internal compiler error: in arm_dbx_register_number, at
>> config/arm/arm.c:21155
>>
>> when compiling thumb multilib libstdc++.
>
> Richard Earnshaw has already reported this in the PR, and here is my fix for
> that.  I don't have any arm boxes, so will just test it on x86_64-linux and
> i686-linux (the PR44694 patch has been tested also on ppc/ppc64/s390/s390x
> btw), could you please test it on arm?  Thanks.
>
> 2010-07-01  Jakub Jelinek<jakub@redhat.com>
>
> 	PR debug/44694
> 	* dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
> 	or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.
>
Yes. This fixes the ICE I saw. Thanks!
Jakub Jelinek - July 1, 2010, 11:06 a.m.
On Thu, Jul 01, 2010 at 10:22:05AM +0200, Jakub Jelinek wrote:
> On Thu, Jul 01, 2010 at 04:13:03PM +0800, Jie Zhang wrote:
> > This patch caused ICE for arm-none-eabi target:
> > 
> > internal compiler error: in arm_dbx_register_number, at
> > config/arm/arm.c:21155
> > 
> > when compiling thumb multilib libstdc++.
> 
> Richard Earnshaw has already reported this in the PR, and here is my fix for
> that.  I don't have any arm boxes, so will just test it on x86_64-linux and
> i686-linux (the PR44694 patch has been tested also on ppc/ppc64/s390/s390x
> btw), could you please test it on arm?  Thanks.
> 
> 2010-07-01  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR debug/44694
> 	* dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
> 	or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.

Now bootstrapped/regtested on x86_64-linux and i686-linux.  Ok for trunk/4.5?

> --- gcc/dwarf2out.c.jj	2010-07-01 08:45:55.000000000 +0200
> +++ gcc/dwarf2out.c	2010-07-01 09:19:47.000000000 +0200
> @@ -12999,6 +12999,26 @@ reg_loc_descriptor (rtx rtl, enum var_in
>    if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
>      return 0;
>  
> +  /* We only use "frame base" when we're sure we're talking about the
> +     post-prologue local stack frame.  We do this by *not* running
> +     register elimination until this point, and recognizing the special
> +     argument pointer and soft frame pointer rtx's.
> +     Use DW_OP_fbreg offset DW_OP_stack_value in this case.  */
> +  if ((rtl == arg_pointer_rtx || rtl == frame_pointer_rtx)
> +      && eliminate_regs (rtl, VOIDmode, NULL_RTX) != rtl)
> +    {
> +      dw_loc_descr_ref result = NULL;
> +
> +      if (dwarf_version >= 4 || !dwarf_strict)
> +	{
> +	  result = mem_loc_descriptor (rtl, VOIDmode, initialized);
> +	  if (result)
> +	    add_loc_descr (&result,
> +			   new_loc_descr (DW_OP_stack_value, 0, 0));
> +	}
> +      return result;
> +    }
> +
>    regs = targetm.dwarf_register_span (rtl);
>  
>    if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)
> 

	Jakub
Richard Guenther - July 1, 2010, 11:07 a.m.
On Thu, 1 Jul 2010, Jakub Jelinek wrote:

> On Thu, Jul 01, 2010 at 10:22:05AM +0200, Jakub Jelinek wrote:
> > On Thu, Jul 01, 2010 at 04:13:03PM +0800, Jie Zhang wrote:
> > > This patch caused ICE for arm-none-eabi target:
> > > 
> > > internal compiler error: in arm_dbx_register_number, at
> > > config/arm/arm.c:21155
> > > 
> > > when compiling thumb multilib libstdc++.
> > 
> > Richard Earnshaw has already reported this in the PR, and here is my fix for
> > that.  I don't have any arm boxes, so will just test it on x86_64-linux and
> > i686-linux (the PR44694 patch has been tested also on ppc/ppc64/s390/s390x
> > btw), could you please test it on arm?  Thanks.
> > 
> > 2010-07-01  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	PR debug/44694
> > 	* dwarf2out.c (reg_loc_descriptor): For eliminated arg_pointer_rtx
> > 	or frame_pointer_rtx use DW_OP_fbreg offset DW_OP_stack_value.
> 
> Now bootstrapped/regtested on x86_64-linux and i686-linux.  Ok for trunk/4.5?

Ok.

Thanks,
Richard.

> > --- gcc/dwarf2out.c.jj	2010-07-01 08:45:55.000000000 +0200
> > +++ gcc/dwarf2out.c	2010-07-01 09:19:47.000000000 +0200
> > @@ -12999,6 +12999,26 @@ reg_loc_descriptor (rtx rtl, enum var_in
> >    if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
> >      return 0;
> >  
> > +  /* We only use "frame base" when we're sure we're talking about the
> > +     post-prologue local stack frame.  We do this by *not* running
> > +     register elimination until this point, and recognizing the special
> > +     argument pointer and soft frame pointer rtx's.
> > +     Use DW_OP_fbreg offset DW_OP_stack_value in this case.  */
> > +  if ((rtl == arg_pointer_rtx || rtl == frame_pointer_rtx)
> > +      && eliminate_regs (rtl, VOIDmode, NULL_RTX) != rtl)
> > +    {
> > +      dw_loc_descr_ref result = NULL;
> > +
> > +      if (dwarf_version >= 4 || !dwarf_strict)
> > +	{
> > +	  result = mem_loc_descriptor (rtl, VOIDmode, initialized);
> > +	  if (result)
> > +	    add_loc_descr (&result,
> > +			   new_loc_descr (DW_OP_stack_value, 0, 0));
> > +	}
> > +      return result;
> > +    }
> > +
> >    regs = targetm.dwarf_register_span (rtl);
> >  
> >    if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)
> > 
> 
> 	Jakub
> 
>

Patch

--- gcc/dwarf2out.c.jj	2010-07-01 08:45:55.000000000 +0200
+++ gcc/dwarf2out.c	2010-07-01 09:19:47.000000000 +0200
@@ -12999,6 +12999,26 @@  reg_loc_descriptor (rtx rtl, enum var_in
   if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
     return 0;
 
+  /* We only use "frame base" when we're sure we're talking about the
+     post-prologue local stack frame.  We do this by *not* running
+     register elimination until this point, and recognizing the special
+     argument pointer and soft frame pointer rtx's.
+     Use DW_OP_fbreg offset DW_OP_stack_value in this case.  */
+  if ((rtl == arg_pointer_rtx || rtl == frame_pointer_rtx)
+      && eliminate_regs (rtl, VOIDmode, NULL_RTX) != rtl)
+    {
+      dw_loc_descr_ref result = NULL;
+
+      if (dwarf_version >= 4 || !dwarf_strict)
+	{
+	  result = mem_loc_descriptor (rtl, VOIDmode, initialized);
+	  if (result)
+	    add_loc_descr (&result,
+			   new_loc_descr (DW_OP_stack_value, 0, 0));
+	}
+      return result;
+    }
+
   regs = targetm.dwarf_register_span (rtl);
 
   if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)