--enable-werror-always fails function.o for any non-pic target
Ian Lance Taylor
iant@google.com
Sat Nov 5 00:58:00 GMT 2011
DJ Delorie <dj@redhat.com> writes:
> gcc/function.c: In function 'thread_prologue_and_epilogue_insns':
> gcc/regs.h:322:34: error: array subscript is above array bounds [-Werror=array-bounds]
>
> function.c has this:
>
> if (pic_offset_table_rtx)
> add_to_hard_reg_set (&set_up_by_prologue, Pmode,
> PIC_OFFSET_TABLE_REGNUM);
>
> Which ends up here:
>
> static inline unsigned int
> end_hard_regno (enum machine_mode mode, unsigned int regno)
> {
> return regno + hard_regno_nregs[regno][(int) mode];
> }
>
> but if PIC_OFFSET_TABLE_REGNUM isn't defined by the target, you get:
>
> #ifndef PIC_OFFSET_TABLE_REGNUM
> #define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
> #endif
>
> which is ~0 and *always* out of range.
But if PIC_OFFSET_TABLE_REGNUM == INVALID_REGNUM, then
pic_offset_table_rtx should be NULL_RTX. See init_emit_regs in
emit-rtl.c. So I think there must be something else going on here.
Ian
More information about the Gcc
mailing list