"Steve Ellcey " <[email protected]> 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
> [email protected]
>
>
> 2012-12-11 Steve Ellcey <[email protected]>
>
> * 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