-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GMP] Add version 6.3.0 #7253
[GMP] Add version 6.3.0 #7253
Conversation
__gmp_divide_by_zero (void) | ||
{ | ||
+ /* try to force a division by zero system exception */ | ||
+ __gmp_junk = 10 / __gmp_0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that by default, GMP now uses __gmp_exception
which in turn does this:
/* Use SIGFPE on systems which have it. Otherwise, deliberate divide
by zero, which triggers an exception on most systems. On those
where it doesn't, for example power and powerpc, use abort instead. */
void
__gmp_exception (int error_bit)
{
gmp_errno |= error_bit;
#ifdef SIGFPE
raise (SIGFPE);
#else
__gmp_junk = 10 / __gmp_0;
#endif
abort ();
}
I wonder: instead of patching GMP to force division by zero here, could/should we catch SIGFPE instead?
Note that this also affects the overflow func patch, see my other comment
+static void | ||
+__gmp_default_alloc_overflow(void) | ||
{ | ||
__gmp_exception (GMP_ERROR_MPZ_OVERFLOW); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the overflow patch could be omitted if we instead caught SIGFPE and handled gmp_errno
suitably.
Alternatively (and perhaps better), we could just use a single patch which adds an optional callback to __gmp_exception
, and then it is up to us how want to handle the exception. Perhaps we could even convince the GMP folks to accept such a patch properly?
Note to self: maybe also patch libtool, see https://gmplib.org/list-archives/gmp-bugs/2023-July/005296.html |
Another note to self: also update MPFR to 4.2.1, see https://gmplib.org/list-archives/gmp-discuss/2023-August/006913.html |
Done in #7872 |
A few weeks ago, GMP 6.3.0 was released. Besides integrating some of the patches we already used, it has some other nice improvements.
However, since this is used by Julia itself, handling it is a bit delicate... or at least that's how I remember it... We also need to coordinate this with the Julia side. So for now this is just a draft.