On Mon, Nov 16, 2026 at 08:28:32PM +0000, John Scott wrote:
> 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,
In both glibc and musl we have
glibc:
/* Use the same type for `jmp_buf' and `sigjmp_buf'.
The `__mask_was_saved' flag determines whether
or not `longjmp' will restore the signal mask. */
typedef struct __jmp_buf_tag sigjmp_buf[1];
musl:
typedef jmp_buf sigjmp_buf;
so it is not a ABI break.
Windows is handled by #if !defined(HAS_SIGSETJMP)
> 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.
Good luck getting macos to fix their pthread bugs...
Cheers,
--
Bill. <[email protected]>
Imagine a large red swirl here.