Tobias Hansen wrote:
> Could the headers keep using jmp_buf in the public declarations, or otherwise 
> avoid requiring sigjmp_buf to be visible, so that pari.h works again with 
> strict ISO C compilers?

I have some thoughts: currently the problematic part of the header is
struct gp_context {
        …
        sigjmp_buf *iferr_env;
        …
};

Note that the types sigjmp_buf and jmp_buf are not interchangeable, so this 
could be an ABI break for applications. But also, it seems like PARI/GP 
(upstream) uses this definition even on Windows, which they intend to support 
but which doesn't have sigjmp_buf of sigsetjmp()/setlongjmp(). I mention this 
only to say that the change in PARI 2.19.1 might be having more consequences 
than intended. If application code exists that might've used setjmp() or 
longjmp() on iferr_env before, then it's now undefined behavior to do so, 
unless those applications convert to sigsetjmp()/siglongjmp(). 

I also want to point out this note in the bug submitter's initial patch at 
https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2715
> /* Darwin longjmp restores signal masks with sigprocmask, which changes the 
> masks of all threads.
I don't believe this is POSIX-conforming behavior: although the POSIX language 
isn't totally crystal clear, the signal mask is a per-thread attribute, and I 
don't think setjmp()/longjmp()'s minimally-specified behavior with respect to 
signal masks is intended to permit mangling the signal masks of *other 
unrelated threads*. This broken behavior ought to be fixed if it really is 
present, by switching to pthread_sigmask() in its longjmp() implementation or 
similar.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to