This is the mail archive of the gcc-bugs@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]

[Bug target/83368] alloca after setjmp breaks PIC base reg


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83368

--- Comment #14 from James Clarke <jrtc27 at jrtc27 dot com> ---
(In reply to Eric Botcazou from comment #12)
> > Can't be done without an ABI break. But it is just the PIC register, and I'm
> > still of the view this is a GCC bug. You seem to not be listening to my
> > arguments and just reciting that "setjmp must save call-saved registers",
> > which would be nice if it were true, but that's not what actually happens,
> > and GCC already tries to handle this; it just misses a case on SPARC.
> 
> OK, let's see it the other way around: how does it work on other
> architectures?  Does GCC save and restore the PIC register or it is
> preserved through the call to setjmp?

It's true that, as far as I'm aware, no other architecture has this issue, as
either the PIC register is caller-saved, or it gets saved by setjmp. However
the original SPARC library authors clearly thought of this and decided it was
the responsibility of the compiler to not rely on input or local registers
being preserved given their explicit note in SCD, so whether or not you believe
that this was a good idea, that's what they chose and what we currently have,
and GCC is not adhering to that. Sure, it would be nice if the registers were
saved by setjmp, but it's documented behaviour and thus not a bug as such in
glibc nor Solaris's libc.

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