From 6921196b1de16fa296f70d12610f85dad8c298f4 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 12 Oct 2017 21:06:23 -0700 Subject: bigrecy patch for 32-bit bignum failures Cherry-picked a single commit from upstream. Turns out this bug (which was causing test failures and thus FTBFS on a subset of platforms) had been identified and fixed upstream a year ago, but had not made it's way into version control (CVS) or the Changelog. See also: http://lists.gnu.org/archive/html/scm-discuss/2017-10/msg00009.html --- debian/changelog | 7 +++ debian/patches/bigrecy_32bit_upstream.patch | 92 +++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 100 insertions(+) create mode 100644 debian/patches/bigrecy_32bit_upstream.patch diff --git a/debian/changelog b/debian/changelog index 6361b65..2fd13ad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +scm (5f2-2) UNRELEASED; urgency=medium + + * Cherry-pick Jakub Bogusz's upstream patch to fix a 32-bit platform bignum + bug causing test failures and FTBFS (Closes: #874112) + + -- Bryan Newbold Thu, 12 Oct 2017 21:01:09 -0700 + scm (5f2-1) unstable; urgency=medium * New upstream release (Closes: #791958) with improved floating point diff --git a/debian/patches/bigrecy_32bit_upstream.patch b/debian/patches/bigrecy_32bit_upstream.patch new file mode 100644 index 0000000..c103141 --- /dev/null +++ b/debian/patches/bigrecy_32bit_upstream.patch @@ -0,0 +1,92 @@ +Description: Support ARM64 ("aarch64") platform +Author: Jakub Bogusz +--- a/scl.c 2015/01/03 20:50:15 1.142 ++++ b/scl.c 2016/08/10 02:33:05 1.143 +@@ -166,33 +166,34 @@ + /* try first with starved precision */ + { + num = scm_ash(mant, MAKINUM(e2 - point)); +- bigrecy(mant); ++ if (num != mant) bigrecy(mant); + quo = scm_round_quotient(num, VELTS(pows5)[(long) point]); + if (pmantexp2dbl(quo, point) != f) { +- bigrecy(quo); quo = num; ++ if (quo != num) { bigrecy(quo); quo = num; } + num = scm_ash(quo, MAKINUM(1L)); +- bigrecy(quo); ++ if (num != quo) bigrecy(quo); + quo = scm_round_quotient(num, VELTS(pows5)[(long) --point]); + } ++ if (num != quo) bigrecy(num); + } + } else { /* e2 <= 0 */ + /* try first with starved precision */ + { + SCM den = scm_ash(MAKINUM(1L), MAKINUM(point - e2)); + num = product(mant, VELTS(pows5)[- (long) point]); +- bigrecy(mant); ++ if (num != mant) { bigrecy(mant); if (mant != MAKINUM(1)) mant = INUM0; } + quo = scm_round_quotient(num, den); + if (pmantexp2dbl(quo, point) != f) { +- bigrecy(quo); quo = num; ++ if (quo != num) { bigrecy(quo); quo = num; } + point--; + num = product(quo, MAKINUM(10)); + if (mant != MAKINUM(1)) bigrecy(quo); + quo = scm_round_quotient(num, den); +- } ++ if (quo != num) bigrecy(num); ++ } else if ((mant != MAKINUM(1)) && (quo != num)) bigrecy(num); + bigrecy(den); + } + } +- bigrecy(num); + a[ch++] = '.'; + /* if (sizeof(UBIGLONG)>=sizeof(double)) /\* Is ulong larger than mantissa? *\/ */ + /* ch += iulong2str(num2ulong(quo, (char *)ARG1, s_number2string), 10, &a[ch]); */ +@@ -680,7 +681,7 @@ + ans = ldexp(ans, bex + point); + } + if (num != quo) bigrecy(quo); +- if (bmant != MAKINUM(1L)) bigrecy(num); ++ if ((num != bmant) && (bmant != MAKINUM(1L))) bigrecy(num); + return ans; + } else { + int maxpow = LENGTH(pows5) - 1; +@@ -696,7 +697,7 @@ + quo = scm_round_quotient(num, scm_ash(scl, MAKINUM(1L))); + } + if (-point > maxpow) bigrecy(scl); +- bigrecy(num); ++ if (num != quo) bigrecy(num); + ans = ldexp(int2dbl(quo), bex + point); + bigrecy(quo); + return ans; +@@ -2478,7 +2479,7 @@ + tmp = acc; + acc = product(tmp, tz1); + #ifdef BIGDIG +- bigrecy(tmp); ++ if (acc != tmp) bigrecy(tmp); + #endif + break; + } +@@ -2486,7 +2487,7 @@ + tmp = acc; + acc = product(tmp, tz1); + #ifdef BIGDIG +- bigrecy(tmp); ++ if (acc != tmp) bigrecy(tmp); + #endif + } + tmp = tz1; +@@ -2841,8 +2842,8 @@ + bex += j * BITSPERDIG; + if (bex > 0) ans = ldexp(ans, bex); + } ++ if (quo != num) bigrecy(quo); + if (num != b) bigrecy(num); +- if (quo != b) bigrecy(quo); + if (tc16_bigneg==TYP16(b)) return -ans; + return ans; + } diff --git a/debian/patches/series b/debian/patches/series index 102a07f..2f25f43 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ texinfo5_fixes.patch ppc64_short_int.patch arm64_short_int.patch hurd_maxpathlen.patch +bigrecy_32bit_upstream.patch -- cgit v1.2.3