https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83368
--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> 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;
> }
GCC expects all call-saved registers to be preserved by setjmp/longjmp though
and I think that's what is implemented in glibc for other architectures.
> 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.
Because it's a call-saved register.
> 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.
Then you need to convince someone to fix glibc and make setjmp/longjmp preserve
call-saved registers even if the stack pointer is subsequently clobbered. Or
maybe just the PIC register, but I think it's only the tip of the iceberg.