This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/83368] alloca after setjmp breaks PIC base reg
- From: "jrtc27 at jrtc27 dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 19 Dec 2017 10:48:15 +0000
- Subject: [Bug target/83368] alloca after setjmp breaks PIC base reg
- Auto-submitted: auto-generated
- References: <bug-83368-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83368
James Clarke <jrtc27 at jrtc27 dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WONTFIX |---
--- Comment #5 from James Clarke <jrtc27 at jrtc27 dot com> ---
(In reply to Eric Botcazou from comment #4)
> > Therefore, I am of the view that this should be reopened as a bug in GCC.
> > GCC already spills local variables live across a setjmp to the stack (as it
> > can't use input or local registers due to the above note); it should be
> > doing the same for %l7.
>
> No, setjmp/longjmp must preserve the call-saved registers and it does in
> almost all cases, both on Linux and Solaris.
You already have code in sched-deps.c to deal with setjmp potentially not
saving registers it should across all architectures:
if (find_reg_note (insn, REG_SETJMP, NULL))
{
/* This is setjmp. Assume that all registers, not just
hard registers, may be clobbered by this call. */
reg_pending_barrier = MOVE_BARRIER;
}
Why is it so hard to fix this bug? It's a very simple problem that only affects
%l7; all it needs is for it to be spilled and reloaded. This is breaking
real-world code that works on every other architecture I have tried it on, and
telling people to use non-portable built-in functions isn't going to
necessarily be well-received.