"Steve Ellcey " <sell...@mips.com> writes:
> While building libgcc in mips16 mode I found another instance of
> dbx_reg_number aborting that the patch to pr54061 did not fix.
> This code:
>
> extern void __chk_fail (void) __attribute__ ((__noreturn__));
> __strncpy_chk (s1, s2, n, s1len)
> {
>   char c;
>   char *s = s1;
>   if (__builtin_expect (s1len < n, 0))
>     __chk_fail ();
>   while (c != '\0');
>   return s;
> }
>
> aborts when compiled with -O2 -g -fpic -mips16.  The following patch
> fixes it.  OK to checkin?
>
> Steve Ellcey
> sell...@mips.com
>
>
> 2012-12-11  Steve Ellcey  <sell...@mips.com>
>
>       * config/mips/mips.c (mips_option_override): Set
>       mips_dbx_regno[CPRESTORE_SLOT_REGNUM] to IGNORED_DWARF_REGNUM.
>
>
> diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
> index 820b228..8113e5d 100644
> --- a/gcc/config/mips/mips.c
> +++ b/gcc/config/mips/mips.c
> @@ -16760,6 +16760,8 @@ mips_option_override (void)
>    for (i = ALL_COP_REG_FIRST; i <= ALL_COP_REG_LAST; i++)
>      mips_dbx_regno[i] = IGNORED_DWARF_REGNUM;
>  
> +  mips_dbx_regno[CPRESTORE_SLOT_REGNUM] = 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;

If even fake registers like these are going to be used, then I think
we should initialise to IGNORED_DWARF_REGNUM rather than INVALID_REGNUM in:

  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
    {
      mips_dbx_regno[i] = INVALID_REGNUM;
      ...
    }

and remove the ALL_COP_REG loop that was in the earlier patch.

Richard

Reply via email to