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]

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


For example, rx-elf...

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.

Does this warrant another excpetion to -Werror in Makefile.in ?  Or is
there another way to get past this these days?


Index: Makefile.in
===================================================================
--- Makefile.in      (revision 180992)
+++ Makefile.in (working copy)
@@ -195,12 +195,14 @@ GCC_WARN_CXXFLAGS = $(LOOSE_WARN) $($(@D
 # flex output may yield harmless "no previous prototype" warnings
 build/gengtype-lex.o-warn = -Wno-error
 gengtype-lex.o-warn = -Wno-error
 # mips-tfile.c contains -Wcast-qual warnings.
 mips-tfile.o-warn = -Wno-error
 expmed.o-warn = -Wno-error
+# non-PIC targets always get an array-bounds error in thread_prologue_and_epilogue_insns
+function.o-warn = -Wno-error
 
 # All warnings have to be shut off in stage1 if the compiler used then
 # isn't gcc; configure determines that.  WARN_CFLAGS will be either
 # $(GCC_WARN_CFLAGS), or nothing.  Similarly, WARN_CXXFLAGS will be
 # either $(GCC_WARN_CXXFLAGS), or nothing.
 WARN_CFLAGS = @warn_cflags@


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