This patch updates contrib/download_prerequisites to download
newer versions (the latest) of GMP, MPFR and MPC.

Main reason is a newer MPFR that provides C23 functions,
additionally, the usual bug fixes or the new "away from zero"
rounding in MPC might turn out to be useful. GMP also claims
better support for some newer archs.

Current GCC mainline already uses the MPFR 4.2+ functions for
(a)sinpi, (a)cospi, (a)tanpi, and atan2pi, where (e.g.)
'sinpi(n) == sin(n*pi)': In the middle end as C23 builtin
and additionally in the gfortran FE as those are also F2023
functions. There are additional C23 functions that will profit
from MPFR support, but still have to be added. See PR 118592
(esp. comment 2) for the list - and below for the list of
new MPFR functions 4.2+ brings.

Note: ISL (0.24, latest 0.27) and gettext (0.22, latest 0.26)
have not been updated; that's deferred to a future patch (soon,
if deemed useful, or eventually). See below for some details.

* * *

Remarks:

* download_prerequisites uses
  http://gcc.gnu.org/pub/gcc/infrastructure/
  i.e. before the commit, the new files have to be placed
  there.

* download_prerequisites is just a convenience script;
  users could freely use a newer or older version of the
  libraries (or none for optional ones like ISL) - what
  counts is: https://gcc.gnu.org/install/prerequisites.html

  Still, it makes sense that it works for most or all
  out of the box, esp. on older, non-standard systems.

* Newer ISL versions require C++17, such that a build will
  fail with older compiler like, e.g., GCC-10.5 fails (albeit
  some older ones work with -std=c++1y). - GCC currently
  requires an ISO C++14 compiler (>= GCC 5.4). As there are
  no ISL changes that seem to be extremely important, an
  update does not seem to be sensible.

* Newer gettext version: Gettext 0.26 (released Jul 20, 2025)
  contains a long-overdue update of the gcc-internal-format
  and gfc-internal-format checkings, useful to avoid argument
  bugs in the .po translation.
  Thus, there is some merit in doing an update, but not in
  this patch - and some more testing/checking seems to be
  sensible before doing it.

* For GMP, I see that for Fedora, a C23 patch exists for
  'configure', but for SUSE not. It also seems to build fine
  with GCC 15 here, i.e. the patch does not seem to be
  required and the old, currently downloaded GMP has
  the same configure check, unsurprisingly.
  There are a few other changes to GMP in the distros, but
  none seem to be really affected by 6.2 → 6.3, but I might
  have missed something.
  MPFR and MPC do not seem to have any changes in distros.

[As all libraries are out for a while, the hope is that
serious build errors would have lead to a new minor release,
but that's just a hope.]

* * *

The GMP, MPFR, MPC version, used for the patch and to be added
to http://gcc.gnu.org/pub/gcc/infrastructure/ are:

* GMP 6.3.0 (2023-07-30, latest) [currently: 6.2.0]
- https://gmplib.org/
- For better compatibility, not the .xz file but the .bz2 file
  has been used → https://gmplib.org/download/gmp/

* MPFR 4.2.2 (2025-03-20, latest) [currently: 4.1.0]:
- https://www.mpfr.org/mpfr-current/

* MPC 1.3.1 (December 2022, latest) [currently: 1.2.1]:
- https://www.multiprecision.org/mpc/download.html
- Requires GMP 5.0.0+ and MPFR 4.1.0+

* * *

Testing:

An in-tree bootstrap GCC mainline with only the three libraries
suggested has been done on:

* x86-64 GNU Linux with a GCC 15 system compiler
  + running the testsuite (which hopefully picked up the just
  build libraries and not the system's ones).

* on cfarm13 5.10.0-32-amd64 with GCC 10.2.1 (Debian 11/bullseye)
  + a partial testsuite run

* on cfarm70 4.9.0-19-amd64 (Debian 9.13 (stretch); gcc 6.3.0)
  successfully building the stage1 compiler but stopping half-way
  through stage1 library build. (Slow system!)


Otherwise, on #gcc IRC on Tue Jul 15 2025:

- Iain pointed out to the ISL issue and remarked:
"AFAIK the other pre-reqs build fine in-tree (I've been using gmp-6.3,
 mpfr 4.2.1, mpc-1.2.1 and gettext-0.22.5) - but sure I tried mpc-1.3.1
 on at least one system."

* * *

OK for mainline? (Requires a prior update of 'infrastructure').

* * *

Tobias

PS: CHANGES from the respective NEW files.
I additionally note that MPFR's configure now uses '#include "gmp.c"'
instead of '#include <gmp.h>' which together with other configure
changes (see below) might actually improve the build experience.


GMP 6.2.0 to 6.3.1 - from the NEWS file:

  BUGS FIXED
  * A possible overflow of type int is avoided for mpz_cmp on huge operands.
  * A possible error condition when a malformed file is read with
    mpz_inp_raw is now correctly handled.

  FEATURES
  * New public function mpz_prevprime, companion of the existing
    mpz_nextprime.
  * New documented pointer types mpz_ptr, mpz_srcptr, and similar for
    other GMP types. Refer to the manual for full list and suggested
    usage. These types have been present in gmp.h at least since
    GMP-4.0, but previously not advertised to users.
  * Support for 64-bit Arm under Macos.
  * Support for the loongarch64 CPU family.
  * Support for building with LTO, link-time optimisations.

  SPEEDUPS
  * New special code for base = 2 in mpz_powm reduces the average time
    for the functions that test primality.
  * Speedup for the function mpz_nextprime on large operands.
  * Speedup for multiplications (some sizes only) thanks to new
    internal functions to compute small negacyclic products.
  * Special assembly code for IBM z13 and later "mainframe" CPUs, resulting in
    a huge speedup.
  * Improved assembly for several 64-bit x86 CPUs, Risc-V, 64-bit Arm.


MPFR 4.1.0 to 4.2.2 - from the NEWS file:

- In order to resolve a portability issue with the _Float128 fallback to
  __float128 for binary128 support (e.g. with Clang and glibc 2.41), the
  prototypes of the corresponding conversion functions had to be changed,
  with _Float128 replaced by mpfr_float128, where mpfr_float128 is a macro
  defined as _Float128 by default. This changes neither the ABI nor the API
  (except that the end user of MPFR would need to define mpfr_float128 as
  the actual type for the binary128 format if this is not the standard
  _Float128 type).
- Other bug fixes (see <https://www.mpfr.org/mpfr-4.2.1/#fixed> and/or the
  ChangeLog file). In particular, the formatted output functions behaved
  incorrectly with %c on the value 0; such a use is uncommon, but this bug
  may have security implications.
- Improved MPFR manual.
- Detect the use of GMP's buggy vsnprintf replacement at configure time.
  With it, the tests of "%a" will be disabled to avoid an assertion failure
  in the MPFR testsuite. A warning will be displayed in the configure output
  in such a case.
- Bug fixes (see <https://www.mpfr.org/mpfr-4.2.0/#fixed> and/or the
  ChangeLog file).
- Improved MPFR manual.
- Configure tests: replaced the test of the link with GMP, in order to
  avoid the use of a function without a prototype (Autoconf issue), as
  this is obsolescent in ISO C. The new test should be more robust.
- The "fondue savoyarde" release.
- Binary compatible with MPFR 4.0.* and 4.1.*, though some minor changes in
  the behavior of the formatted output functions may be visible, regarded
  as underspecified behavior or bug fixes (see below).
- New functions mpfr_cosu, mpfr_sinu, mpfr_tanu, mpfr_acosu, mpfr_asinu,
  mpfr_atanu and mpfr_atan2u.
- New functions mpfr_cospi, mpfr_sinpi, mpfr_tanpi, mpfr_acospi, mpfr_asinpi,
  mpfr_atanpi and mpfr_atan2pi.
- New functions mpfr_log2p1, mpfr_log10p1, mpfr_exp2m1, mpfr_exp10m1 and
  mpfr_compound_si.
- New functions mpfr_fmod_ui, mpfr_powr, mpfr_pown, mpfr_pow_uj, mpfr_pow_sj
  and mpfr_rootn_si (mpfr_pown is actually a macro defined as an alias for
  mpfr_pow_sj).
- Bug fixes.
  In particular, for the formatted output functions (mpfr_printf, etc.),
  the case where the precision consists only of a period has been fixed
  to be like ".0" as specified in the ISO C standard, and the manual has
  been corrected and clarified.
  The macros of the custom interface have also been fixed: they now behave
  like functions (except a minor limitation for mpfr_custom_init_set).


MPC 1.2.1 to 1.3.1 - from the NEWS file:

  - Bug fix: It is again possible to include mpc.h without including
    stdio.h.
  - New function: mpc_agm
  - New rounding modes "away from zero", indicated by the letter "A" and
    corresponding to MPFR_RNDA on the designated real or imaginary part.
  - New experimental ball arithmetic.
  - New experimental function: mpc_eta_fund
  - Bug fixes:
    - mpc_asin for asin(z) with small |Re(z)| and tiny |Im(z)|
    - mpc_pow_fr: sign of zero part of result when the base has up to sign
      the same real and imaginary part, and the exponent is an even
      positive integer
    - mpc_fma: the returned 'int' value was incorrect in some cases (indicating
      whether the rounded real/imaginary parts were smaller/equal/greater
      than the exact values), but the computed complex value was correct.
  - Remove the unmaintained Makefile.vc; build files for Visual Studio
    can be found at https://github.com/BrianGladman/mpc .
contrib/download_prerequisites: Update GMP, MPFR, MPC [PR120237]

Download newer versions of GMP, MPFR and MPC (the latest); besides the usual
bug fixes and smaller features, MPFR adds new functions for C23, some of
which are already used in GCC in the middle (fold-const-call.cc) and in
Fortran 2023 for the 'pi' trignonometric functions, if MPFR is new enough.

contrib/ChangeLog:

	PR other/120237
	* download_prerequisites: Update to download GMP 6.3.0 (before 6.2.1),
	MPFR 4.2.2 (before 4.1.0), and MPC 1.3.1 (before 1.2.1).
	* prerequisites.md5: Update hash.
	* prerequisites.sha512: Likewise.

 contrib/download_prerequisites | 6 +++---
 contrib/prerequisites.md5      | 6 +++---
 contrib/prerequisites.sha512   | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites
index b83fcc9db5d..39e8a500a29 100755
--- a/contrib/download_prerequisites
+++ b/contrib/download_prerequisites
@@ -27,9 +27,9 @@ version='(unversioned)'
 # remember to also update the files `contrib/prerequisites.sha512` and
 # `contrib/prerequisites.md5` with the new checksums.
 
-gmp='gmp-6.2.1.tar.bz2'
-mpfr='mpfr-4.1.0.tar.bz2'
-mpc='mpc-1.2.1.tar.gz'
+gmp='gmp-6.3.0.tar.xz'
+mpfr='mpfr-4.2.2.tar.bz2'
+mpc='mpc-1.3.0.tar.gz'
 isl='isl-0.24.tar.bz2'
 gettext='gettext-0.22.tar.gz'
 
diff --git a/contrib/prerequisites.md5 b/contrib/prerequisites.md5
index 716a9ff910c..96b9802d901 100644
--- a/contrib/prerequisites.md5
+++ b/contrib/prerequisites.md5
@@ -1,5 +1,5 @@
-28971fc21cf028042d4897f02fd355ea  gmp-6.2.1.tar.bz2
-44b892bc5a45bafb4294d134e13aad1d  mpfr-4.1.0.tar.bz2
-9f16c976c25bb0f76b50be749cd7a3a8  mpc-1.2.1.tar.gz
+c1cd6ef33085e9cb818b9b08371f9000  gmp-6.3.0.tar.bz2
+afe8268360bc8702fbc8297d351c8b5e  mpfr-4.2.2.tar.bz2
+5c9bc658c9fd0f940e8e3e0f09530c62  mpc-1.3.1.tar.gz
 dd2f7b78e118c25bd96134a52aae7f4d  isl-0.24.tar.bz2
 c092102240f8f66134d22718421d5115  gettext-0.22.tar.gz
diff --git a/contrib/prerequisites.sha512 b/contrib/prerequisites.sha512
index f71398bdbc3..7a3e9c2cbf7 100644
--- a/contrib/prerequisites.sha512
+++ b/contrib/prerequisites.sha512
@@ -1,5 +1,5 @@
-8904334a3bcc5c896ececabc75cda9dec642e401fb5397c4992c4fabea5e962c9ce8bd44e8e4233c34e55c8010cc28db0545f5f750cbdbb5f00af538dc763be9  gmp-6.2.1.tar.bz2
-410208ee0d48474c1c10d3d4a59decd2dfa187064183b09358ec4c4666e34d74383128436b404123b831e585d81a9176b24c7ced9d913967c5fce35d4040a0b4  mpfr-4.1.0.tar.bz2
-3279f813ab37f47fdcc800e4ac5f306417d07f539593ca715876e43e04896e1d5bceccfb288ef2908a3f24b760747d0dbd0392a24b9b341bc3e12082e5c836ee  mpc-1.2.1.tar.gz
+3b684c9bcb9ede2b7e54d0ba4c9764bfa17c20d4f3000017c553b6f1e135b536949580ff37341680c25dc236cfe0ba1db8cfdfe619ce013656189ef0871b89f8  gmp-6.3.0.tar.bz2
+0176e50808dcc07afbf5bc3e38bf9b7b21918e5f194aa0bfd860d99b00c470630aef149776c4be814a61c44269c3a5b9a4b0b1c0fcd4c9feb1459d8466452da8  mpfr-4.2.2.tar.bz2
+4bab4ef6076f8c5dfdc99d810b51108ced61ea2942ba0c1c932d624360a5473df20d32b300fc76f2ba4aa2a97e1f275c9fd494a1ba9f07c4cb2ad7ceaeb1ae97  mpc-1.3.1.tar.gz
 aab3bddbda96b801d0f56d2869f943157aad52a6f6e6a61745edd740234c635c38231af20bc3f1a08d416a5e973a90e18249078ed8e4ae2f1d5de57658738e95  isl-0.24.tar.bz2
 e2a58dde1cae3e6b79c03e7ef3d888f7577c1f4cba283b3b0f31123ceea8c33d7c9700e83de57104644de23e5f5c374868caa0e091f9c45edbbe87b98ee51c04  gettext-0.22.tar.gz

Reply via email to