[patch, mips, debug] Fix PR 54061, mips compiler aborts in testsuite

Richard Sandiford rdsandiford@googlemail.com
Sat Dec 8 10:15:00 GMT 2012


Steve Ellcey <sellcey@mips.com> writes:
> diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
> index b6a2290..bc99f29 100644
> --- a/gcc/config/mips/mips.c
> +++ b/gcc/config/mips/mips.c
> @@ -16757,6 +16757,9 @@ mips_option_override (void)
>    for (i = FP_REG_FIRST; i <= FP_REG_LAST; i++)
>      mips_dbx_regno[i] = i + start;
>  
> +  for (i = COP0_REG_FIRST; i <= COP3_REG_LAST; i++)
> +    mips_dbx_regno[i] = IGNORED_DWARF_REGNUM;
> +
>    /* Accumulator debug registers use big-endian ordering.  */
>    mips_dbx_regno[HI_REGNUM] = MD_DBX_FIRST + 0;
>    mips_dbx_regno[LO_REGNUM] = MD_DBX_FIRST + 1;

While you're here, I think we should replace:

 /* ALL_COP_REG_NUM assumes that COP0,2,and 3 are numbered consecutively.  */
 #define ALL_COP_REG_NUM (COP3_REG_LAST - COP0_REG_FIRST + 1)

with:

 /* These definitions assume that COP0, 2 and 3 are numbered consecutively.  */
 #define ALL_COP_REG_FIRST COP0_REG_FIRST
 #define ALL_COP_REG_LAST COP3_REG_LAST
 #define ALL_COP_REG_NUM (ALL_COP_REG_LAST - ALL_COP_REG_FIRST + 1)

and the use ALL_COP_REG_{FIRST,LAST} in your new loop.  It feels wrong
to iterate with bounds from different ranges.

The MIPS parts are OK with that change.  Thanks for fixing this,
was going to try tackling it this weekend :-)

As far as the dwarf2out.c bits go, I think the original dbx_reg_number assert:

  gcc_assert (regno != INVALID_REGNUM);

should become:

  gcc_assert (regno != INVALID_REGNUM && regno != IGNORED_DWARF_REGNUM);

since it's the caller's job to handle this case.

Richard



More information about the Gcc-patches mailing list