This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: --enable-werror-always fails function.o for any non-pic target
- From: Ian Lance Taylor <iant at google dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 04 Nov 2011 17:57:57 -0700
- Subject: Re: --enable-werror-always fails function.o for any non-pic target
- References: <201111050052.pA50q8LZ018355@greed.delorie.com>
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