mirror of
https://github.com/termux/termux-packages
synced 2024-06-15 19:28:38 +00:00
libmpfr: Backport fix for mpfr_custom_get_kind
Supersedes commit b5db8627a0
.
This commit is contained in:
parent
9e7f00b2d0
commit
87cd35c967
|
@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="C library for multiple-precision floating-point computat
|
||||||
TERMUX_PKG_LICENSE="LGPL-3.0"
|
TERMUX_PKG_LICENSE="LGPL-3.0"
|
||||||
TERMUX_PKG_MAINTAINER="@termux"
|
TERMUX_PKG_MAINTAINER="@termux"
|
||||||
TERMUX_PKG_VERSION=4.1.1
|
TERMUX_PKG_VERSION=4.1.1
|
||||||
TERMUX_PKG_REVISION=1
|
TERMUX_PKG_REVISION=2
|
||||||
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/mpfr/mpfr-${TERMUX_PKG_VERSION}.tar.xz
|
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/mpfr/mpfr-${TERMUX_PKG_VERSION}.tar.xz
|
||||||
TERMUX_PKG_SHA256=ffd195bd567dbaffc3b98b23fd00aad0537680c9896171e44fe3ff79e28ac33d
|
TERMUX_PKG_SHA256=ffd195bd567dbaffc3b98b23fd00aad0537680c9896171e44fe3ff79e28ac33d
|
||||||
TERMUX_PKG_DEPENDS="libgmp"
|
TERMUX_PKG_DEPENDS="libgmp"
|
||||||
|
|
87
packages/libmpfr/mpfr-4.1.1-mpfr_custom_get_kind.patch
Normal file
87
packages/libmpfr/mpfr-4.1.1-mpfr_custom_get_kind.patch
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
https://gitlab.inria.fr/mpfr/mpfr/-/commit/3cd39bc0b71ad2fb2ab5252ad9268b14603e3ce6
|
||||||
|
|
||||||
|
From 3cd39bc0b71ad2fb2ab5252ad9268b14603e3ce6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vincent Lefevre <vincent@vinc17.net>
|
||||||
|
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
|
||||||
|
|
||||||
|
(cherry picked from commit 0ce17bae34a6c54de31b126f969d3ddd72c6bc37)
|
||||||
|
---
|
||||||
|
src/mpfr.h | 2 +-
|
||||||
|
tests/tstckintc.c | 10 +++++++---
|
||||||
|
2 files changed, 8 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/mpfr.h b/src/mpfr.h
|
||||||
|
index 6dbf90dca..c5554b7ce 100644
|
||||||
|
--- a/src/mpfr.h
|
||||||
|
+++ b/src/mpfr.h
|
||||||
|
@@ -1027,7 +1027,7 @@ __MPFR_DECLSPEC int mpfr_total_order_p (mpfr_srcptr, mpfr_srcptr);
|
||||||
|
#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 ? \
|
||||||
|
diff --git a/tests/tstckintc.c b/tests/tstckintc.c
|
||||||
|
index e95e81ef9..a0c4486fb 100644
|
||||||
|
--- 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. */
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
--- a/src/mpfr.h
|
|
||||||
+++ b/src/mpfr.h
|
|
||||||
@@ -1026,15 +1026,14 @@
|
|
||||||
|
|
||||||
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
|
|
||||||
#define mpfr_custom_get_kind(x) \
|
|
||||||
- __extension__ ({ \
|
|
||||||
- mpfr_ptr _x = (x); \
|
|
||||||
- _x->_mpfr_exp > __MPFR_EXP_INF ? \
|
|
||||||
- (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (_x) \
|
|
||||||
- : _x->_mpfr_exp == __MPFR_EXP_INF ? \
|
|
||||||
- (mpfr_int) MPFR_INF_KIND * MPFR_SIGN (_x) \
|
|
||||||
- : _x->_mpfr_exp == __MPFR_EXP_NAN ? (mpfr_int) MPFR_NAN_KIND \
|
|
||||||
- : (mpfr_int) MPFR_ZERO_KIND * MPFR_SIGN (_x); \
|
|
||||||
- })
|
|
||||||
+ ( \
|
|
||||||
+ (x)->_mpfr_exp > __MPFR_EXP_INF ? \
|
|
||||||
+ (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (x) \
|
|
||||||
+ : (x)->_mpfr_exp == __MPFR_EXP_INF ? \
|
|
||||||
+ (mpfr_int) MPFR_INF_KIND * MPFR_SIGN (x) \
|
|
||||||
+ : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (mpfr_int) MPFR_NAN_KIND \
|
|
||||||
+ : (mpfr_int) MPFR_ZERO_KIND * MPFR_SIGN (x) \
|
|
||||||
+ )
|
|
||||||
#else
|
|
||||||
#define mpfr_custom_get_kind(x) ((mpfr_custom_get_kind)(x))
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user