From 6bac7bbf46f9f56252325cccaad1f514d344902d Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 24 Nov 2022 01:28:09 +0100 Subject: [PATCH] tools/mpfr: update to 4.1.1 Changes: - Bug fixes - Improved manual formatting Refresh patches: - 001-only_src.patch Import patch fixing macro bug: - 002-Fix-mpfr_custom_get_kind-macro-bug.patch Signed-off-by: Nick Hainke --- tools/mpfr/Makefile | 4 +- tools/mpfr/patches/001-only_src.patch | 4 +- ...2-Fix-mpfr_custom_get_kind-macro-bug.patch | 76 +++++++++++++++++++ 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch diff --git a/tools/mpfr/Makefile b/tools/mpfr/Makefile index 4562c128d4..6a13be7398 100644 --- a/tools/mpfr/Makefile +++ b/tools/mpfr/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mpfr -PKG_VERSION:=4.1.0 +PKG_VERSION:=4.1.1 PKG_CPE_ID:=cpe:/a:mpfr:gnu_mpfr PKG_SOURCE_URL:=@GNU/mpfr http://www.mpfr.org/mpfr-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f +PKG_HASH:=ffd195bd567dbaffc3b98b23fd00aad0537680c9896171e44fe3ff79e28ac33d HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/mpfr/patches/001-only_src.patch b/tools/mpfr/patches/001-only_src.patch index dbc7d32343..68312276c9 100644 --- a/tools/mpfr/patches/001-only_src.patch +++ b/tools/mpfr/patches/001-only_src.patch @@ -1,6 +1,6 @@ --- a/Makefile.am +++ b/Makefile.am -@@ -24,7 +24,7 @@ AUTOMAKE_OPTIONS = gnu +@@ -34,7 +34,7 @@ AUTOMAKE_OPTIONS = gnu # old Automake version. ACLOCAL_AMFLAGS = -I m4 @@ -11,7 +11,7 @@ pkgconfig_DATA = mpfr.pc --- a/Makefile.in +++ b/Makefile.in -@@ -384,7 +384,7 @@ AUTOMAKE_OPTIONS = gnu +@@ -397,7 +397,7 @@ AUTOMAKE_OPTIONS = gnu # libtoolize and in case some developer needs to switch back to an # old Automake version. ACLOCAL_AMFLAGS = -I m4 diff --git a/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch b/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch new file mode 100644 index 0000000000..bb66a9067c --- /dev/null +++ b/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch @@ -0,0 +1,76 @@ +From 0ce17bae34a6c54de31b126f969d3ddd72c6bc37 Mon Sep 17 00:00:00 2001 +From: Vincent Lefevre +Date: Tue, 22 Nov 2022 16:33:00 +0100 +Subject: [PATCH] Fix mpfr_custom_get_kind() macro bug. + +* src/mpfr.h: in the mpfr_custom_get_kind() macro, changed mpfr_ptr to + mpfr_srcptr for _x to agree with the function prototype, in order to + avoid a compilation failure of user code in some cases. This bug was + introduced by commit 9f94e0311ed53d0c64d4fbca249d19cc4888027e, which + introduced the temporary variable _x to avoid an incorrect number of + evaluations of the x argument. +* tests/tstckintc.c: improved the tests to detect this bug. + +This should fix mpfr bug #1. + +Bug initially reported by FX Coudert: + https://github.com/CGAL/cgal/issues/7064 + +It affects Fedora Linux: + https://bugzilla.redhat.com/show_bug.cgi?id=2144197 +--- + src/mpfr.h | 2 +- + tests/tstckintc.c | 10 +++++++--- + 2 files changed, 8 insertions(+), 4 deletions(-) + +--- a/src/mpfr.h ++++ b/src/mpfr.h +@@ -1027,7 +1027,7 @@ __MPFR_DECLSPEC int mpfr_total_order_p ( + #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 + #define mpfr_custom_get_kind(x) \ + __extension__ ({ \ +- mpfr_ptr _x = (x); \ ++ mpfr_srcptr _x = (x); \ + _x->_mpfr_exp > __MPFR_EXP_INF ? \ + (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (_x) \ + : _x->_mpfr_exp == __MPFR_EXP_INF ? \ +--- a/tests/tstckintc.c ++++ b/tests/tstckintc.c +@@ -295,14 +295,16 @@ static void + test_nan_inf_zero (void) + { + mpfr_ptr val; ++ mpfr_srcptr sval; /* for compilation error checking */ + int sign; + int kind; + + reset_stack (); + + val = new_mpfr (MPFR_PREC_MIN); ++ sval = val; + mpfr_set_nan (val); +- kind = (mpfr_custom_get_kind) (val); ++ kind = (mpfr_custom_get_kind) (sval); + if (kind != MPFR_NAN_KIND) + { + printf ("mpfr_custom_get_kind error: "); +@@ -380,7 +382,8 @@ static long * + dummy_set_si (long si) + { + mpfr_t x; +- long * r = dummy_new (); ++ mpfr_srcptr px; /* for compilation error checking */ ++ long *r = dummy_new (); + int i1, i2, i3, i4, i5; + + /* Check that the type "void *" can be used, like with the function. +@@ -405,7 +408,8 @@ dummy_set_si (long si) + MPFR_ASSERTN (i5 == 1); + + mpfr_set_si (x, si, MPFR_RNDN); +- r[0] = mpfr_custom_get_kind (x); ++ px = x; ++ r[0] = mpfr_custom_get_kind (px); + + /* Check that the type "void *" can be used in C, like with the function + (forbidden in C++). Also check side effects. */ -- 2.30.2