Message ID | 20191109194752.2180-1-blomqvist.janne@gmail.com |
---|---|
State | New |
Headers | show |
Series | Bump minimum MPFR version to 3.1.0 | expand |
Hi Janne, > Bump the minimum MPFR version to 3.1.0, released 2011-10-03. With this > requirement one can still build GCC with the operating system provided > MPFR on old but still supported operating systems like SLES 12 (MPFR > 3.1.2) or RHEL/CentOS 7.x (MPFR 3.1.1). > OK for trunk. Can you also make a note in https://gcc.gnu.org/gcc-10/changes.html ? Regards Thomas
On Sun, Nov 10, 2019 at 11:43 AM Thomas Koenig <tkoenig@netcologne.de> wrote: > > Hi Janne, > > > Bump the minimum MPFR version to 3.1.0, released 2011-10-03. With this > > requirement one can still build GCC with the operating system provided > > MPFR on old but still supported operating systems like SLES 12 (MPFR > > 3.1.2) or RHEL/CentOS 7.x (MPFR 3.1.1). > > > > OK for trunk. Thanks, I'll take that as an Ok for the Fortran part. I believe I still need an Ok by a global or build machinery reviewer for the global and docs parts. > Can you also make a note in https://gcc.gnu.org/gcc-10/changes.html ? Sure, will do, when the patch is accepted.
On Sun, 10 Nov 2019, Janne Blomqvist wrote: > Thanks, I'll take that as an Ok for the Fortran part. I believe I > still need an Ok by a global or build machinery reviewer for the > global and docs parts. For the docs parts, and in particular a change like this, only in the most pedantic of worlds imaginable. ;-) That said: okay. And thank you! Gerald
On November 9, 2019 8:47:52 PM GMT+01:00, Janne Blomqvist <blomqvist.janne@gmail.com> wrote: >Bump the minimum MPFR version to 3.1.0, released 2011-10-03. With this >requirement one can still build GCC with the operating system provided >MPFR on old but still supported operating systems like SLES 12 (MPFR >3.1.2) or RHEL/CentOS 7.x (MPFR 3.1.1). > >This allows removing some code in the Fortran frontend, as well as >fixing PR 91828. OK. Thanks, Richard. >ChangeLog: > >2019-11-09 Janne Blomqvist <jb@gcc.gnu.org> > > PR fortran/91828 > * configure.ac: Bump minimum MPFR to 3.1.0, recommended to 3.1.6+. > * configure: Regenerated. > >gcc/ChangeLog: > >2019-11-09 Janne Blomqvist <jb@gcc.gnu.org> > > PR fortran/91828 > * doc/install.texi: Document that the minimum MPFR version is > 3.1.0. > >gcc/fortran/ChangeLog: > >2019-11-09 Janne Blomqvist <jb@gcc.gnu.org> > > PR fortran/91828 > * simplify.c (gfc_simplify_fraction): Remove fallback path for > MPFR < 3.1.0. >--- > configure.ac | 6 +++--- > gcc/doc/install.texi | 2 +- > gcc/fortran/simplify.c | 37 ------------------------------------- > 3 files changed, 4 insertions(+), 41 deletions(-) > >diff --git a/configure.ac b/configure.ac >index b8ce2ad20b9..d63a8bae940 100644 >--- a/configure.ac >+++ b/configure.ac >@@ -1601,12 +1601,12 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = >xno; then > AC_MSG_CHECKING([for the correct version of mpfr.h]) > AC_TRY_COMPILE([#include <gmp.h> > #include <mpfr.h>],[ >- #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0) >+ #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0) > choke me > #endif > ], [AC_TRY_COMPILE([#include <gmp.h> > #include <mpfr.h>],[ >- #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,2) >+ #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,6) > choke me > #endif > ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])], >@@ -1661,7 +1661,7 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = >xno; then > # The library versions listed in the error message below should match > # the HARD-minimums enforced above. > if test x$have_gmp != xyes; then >- AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC >0.8.0+. >+ AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC >0.8.0+. > Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify > their locations. Source code for these libraries can be found at > their respective hosting sites as well as at >diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi >index 2cb8a342a2c..93b01ff7971 100644 >--- a/gcc/doc/install.texi >+++ b/gcc/doc/install.texi >@@ -384,7 +384,7 @@ and @option{--with-gmp-include}. > The in-tree build is only supported with the GMP version that > download_prerequisites installs. > >-@item MPFR Library version 2.4.2 (or later) >+@item MPFR Library version 3.1.0 (or later) > > Necessary to build GCC@. It can be downloaded from > @uref{https://www.mpfr.org}. If an MPFR source distribution is found >diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c >index 2eb1943c3ee..0461d31cd88 100644 >--- a/gcc/fortran/simplify.c >+++ b/gcc/fortran/simplify.c >@@ -3076,12 +3076,7 @@ gfc_expr * > gfc_simplify_fraction (gfc_expr *x) > { > gfc_expr *result; >- >-#if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0) >- mpfr_t absv, exp, pow2; >-#else > mpfr_exp_t e; >-#endif > > if (x->expr_type != EXPR_CONSTANT) > return NULL; >@@ -3095,41 +3090,9 @@ gfc_simplify_fraction (gfc_expr *x) > return result; > } > >-#if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0) >- >- /* MPFR versions before 3.1.0 do not include mpfr_frexp. >- TODO: remove the kludge when MPFR 3.1.0 or newer will be required >*/ >- >- if (mpfr_sgn (x->value.real) == 0) >- { >- mpfr_set (result->value.real, x->value.real, GFC_RND_MODE); >- return result; >- } >- >- gfc_set_model_kind (x->ts.kind); >- mpfr_init (exp); >- mpfr_init (absv); >- mpfr_init (pow2); >- >- mpfr_abs (absv, x->value.real, GFC_RND_MODE); >- mpfr_log2 (exp, absv, GFC_RND_MODE); >- >- mpfr_trunc (exp, exp); >- mpfr_add_ui (exp, exp, 1, GFC_RND_MODE); >- >- mpfr_ui_pow (pow2, 2, exp, GFC_RND_MODE); >- >- mpfr_div (result->value.real, x->value.real, pow2, GFC_RND_MODE); >- >- mpfr_clears (exp, absv, pow2, NULL); >- >-#else >- > /* mpfr_frexp() correctly handles zeros and NaNs. */ > mpfr_frexp (&e, result->value.real, x->value.real, GFC_RND_MODE); > >-#endif >- > return range_check (result, "FRACTION"); > } >
On Sat, 9 Nov 2019, Janne Blomqvist wrote: > Bump the minimum MPFR version to 3.1.0, released 2011-10-03. With this > requirement one can still build GCC with the operating system provided > MPFR on old but still supported operating systems like SLES 12 (MPFR > 3.1.2) or RHEL/CentOS 7.x (MPFR 3.1.1). > > This allows removing some code in the Fortran frontend, as well as > fixing PR 91828. As a remark, beyond the cases where this allows conditional code to be removed, there are also possible cleanups where GCC is currently using MPFR constants / types that are documented as obsolescent <https://gcc.gnu.org/ml/gcc-patches/2016-04/msg01544.html>.
On Mon, Nov 11, 2019 at 8:29 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Sat, 9 Nov 2019, Janne Blomqvist wrote: > > > Bump the minimum MPFR version to 3.1.0, released 2011-10-03. With this > > requirement one can still build GCC with the operating system provided > > MPFR on old but still supported operating systems like SLES 12 (MPFR > > 3.1.2) or RHEL/CentOS 7.x (MPFR 3.1.1). > > > > This allows removing some code in the Fortran frontend, as well as > > fixing PR 91828. > > As a remark, beyond the cases where this allows conditional code to be > removed, there are also possible cleanups where GCC is currently using > MPFR constants / types that are documented as obsolescent > <https://gcc.gnu.org/ml/gcc-patches/2016-04/msg01544.html>. > > -- > Joseph S. Myers > joseph@codesourcery.com Yes, good idea. I filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92463 to keep track of this.
On 11/10/19 4:05 AM, Janne Blomqvist wrote: > On Sun, Nov 10, 2019 at 11:43 AM Thomas Koenig <tkoenig@netcologne.de> wrote: >> >> Hi Janne, >> >>> Bump the minimum MPFR version to 3.1.0, released 2011-10-03. With this >>> requirement one can still build GCC with the operating system provided >>> MPFR on old but still supported operating systems like SLES 12 (MPFR >>> 3.1.2) or RHEL/CentOS 7.x (MPFR 3.1.1). >>> >> >> OK for trunk. > > Thanks, I'll take that as an Ok for the Fortran part. I believe I > still need an Ok by a global or build machinery reviewer for the > global and docs parts. Seems reasonable to me, particularly since 3.1.0 is covered by SLES 12 and RHEL/CentOS 7. Give others a couple day to object though. jeff
On Tue, Nov 12, 2019 at 6:59 AM Jeff Law <law@redhat.com> wrote: > > On 11/10/19 4:05 AM, Janne Blomqvist wrote: > > On Sun, Nov 10, 2019 at 11:43 AM Thomas Koenig <tkoenig@netcologne.de> wrote: > >> > >> Hi Janne, > >> > >>> Bump the minimum MPFR version to 3.1.0, released 2011-10-03. With this > >>> requirement one can still build GCC with the operating system provided > >>> MPFR on old but still supported operating systems like SLES 12 (MPFR > >>> 3.1.2) or RHEL/CentOS 7.x (MPFR 3.1.1). > >>> > >> > >> OK for trunk. > > > > Thanks, I'll take that as an Ok for the Fortran part. I believe I > > still need an Ok by a global or build machinery reviewer for the > > global and docs parts. > Seems reasonable to me, particularly since 3.1.0 is covered by SLES 12 > and RHEL/CentOS 7. Give others a couple day to object though. Richard Biener already Ok'd it and I committed the patch yesterday.
diff --git a/configure.ac b/configure.ac index b8ce2ad20b9..d63a8bae940 100644 --- a/configure.ac +++ b/configure.ac @@ -1601,12 +1601,12 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then AC_MSG_CHECKING([for the correct version of mpfr.h]) AC_TRY_COMPILE([#include <gmp.h> #include <mpfr.h>],[ - #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0) + #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0) choke me #endif ], [AC_TRY_COMPILE([#include <gmp.h> #include <mpfr.h>],[ - #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,2) + #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,6) choke me #endif ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])], @@ -1661,7 +1661,7 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then # The library versions listed in the error message below should match # the HARD-minimums enforced above. if test x$have_gmp != xyes; then - AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+. + AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+. Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations. Source code for these libraries can be found at their respective hosting sites as well as at diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 2cb8a342a2c..93b01ff7971 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -384,7 +384,7 @@ and @option{--with-gmp-include}. The in-tree build is only supported with the GMP version that download_prerequisites installs. -@item MPFR Library version 2.4.2 (or later) +@item MPFR Library version 3.1.0 (or later) Necessary to build GCC@. It can be downloaded from @uref{https://www.mpfr.org}. If an MPFR source distribution is found diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 2eb1943c3ee..0461d31cd88 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -3076,12 +3076,7 @@ gfc_expr * gfc_simplify_fraction (gfc_expr *x) { gfc_expr *result; - -#if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0) - mpfr_t absv, exp, pow2; -#else mpfr_exp_t e; -#endif if (x->expr_type != EXPR_CONSTANT) return NULL; @@ -3095,41 +3090,9 @@ gfc_simplify_fraction (gfc_expr *x) return result; } -#if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0) - - /* MPFR versions before 3.1.0 do not include mpfr_frexp. - TODO: remove the kludge when MPFR 3.1.0 or newer will be required */ - - if (mpfr_sgn (x->value.real) == 0) - { - mpfr_set (result->value.real, x->value.real, GFC_RND_MODE); - return result; - } - - gfc_set_model_kind (x->ts.kind); - mpfr_init (exp); - mpfr_init (absv); - mpfr_init (pow2); - - mpfr_abs (absv, x->value.real, GFC_RND_MODE); - mpfr_log2 (exp, absv, GFC_RND_MODE); - - mpfr_trunc (exp, exp); - mpfr_add_ui (exp, exp, 1, GFC_RND_MODE); - - mpfr_ui_pow (pow2, 2, exp, GFC_RND_MODE); - - mpfr_div (result->value.real, x->value.real, pow2, GFC_RND_MODE); - - mpfr_clears (exp, absv, pow2, NULL); - -#else - /* mpfr_frexp() correctly handles zeros and NaNs. */ mpfr_frexp (&e, result->value.real, x->value.real, GFC_RND_MODE); -#endif - return range_check (result, "FRACTION"); }