Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

fingolfin
Copy link
Member

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.

__gmp_divide_by_zero (void)
{
+ /* try to force a division by zero system exception */
+ __gmp_junk = 10 / __gmp_0;
Copy link
Member Author

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);
Copy link
Member Author

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?

@fingolfin
Copy link
Member Author

Note to self: maybe also patch libtool, see https://gmplib.org/list-archives/gmp-bugs/2023-July/005296.html

@fingolfin
Copy link
Member Author

Another note to self: also update MPFR to 4.2.1, see https://gmplib.org/list-archives/gmp-discuss/2023-August/006913.html

@ViralBShah
Copy link
Member

Done in #7872

@ViralBShah ViralBShah closed this May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants