This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: --enable-werror-always fails function.o for any non-pic target


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]