This is the mail archive of the
mailing list for the GCC project.
Re: [PATH] PR 5126, fix for m68k PIC optimization bug
- From: Steve Woodford <steve at mctavish dot co dot uk>
- To: Richard Henderson <rth at redhat dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 16 Dec 2001 09:34:04 +0000 (GMT)
- Subject: Re: [PATH] PR 5126, fix for m68k PIC optimization bug
On Sat, 15 Dec 2001, Richard Henderson wrote:
> On Sat, Dec 15, 2001 at 04:08:26PM -0500, Craig Rodrigues wrote:
> > - if (flag_pic && current_function_uses_pic_offset_table)
> > + if (flag_pic && current_function_uses_pic_offset_table &&
> > + regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
> This isn't correct. References to the pic register may be
> added during reload, which will not update regs_ever_live.
I had a feeling this was the case, which is why I haven't committed this
change to NetBSD's in-tree gcc. Thanks for confirming my suspicion.
> We need to either obey current_function_uses_pic_offset_table
> everywhere (meaning m68k_output_function_prologue must save
> this register above), or we must take special care to update
> regs_ever_live during reload in legitimize_pic_address. If we
> do the later, it is likely that current_function_uses_pic_offset_table
> is obsolete.
Well, in the interim on NetBSD (at least until I figure out the Right Way)
I'm going to take the former approach and add %a5 to the save/restore mask
in the prologue/epilogue functions based on
current_function_uses_pic_offset_table. This will produce suboptimal code
in the test case, but at least it will be functionally _correct_ code.