summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2014-07-08 03:39:55 +0000
committerNicolás Reynolds <fauno@endefensadelsl.org>2014-07-08 03:39:55 +0000
commit7f65cca764732fe9c5f501ca636b4e2382bfd90d (patch)
treeab8674433b0d05867b47d6e48f9530d83047f75c /core
parentecc0814f13d77a15db732a279e7bcc143f403683 (diff)
Tue Jul 8 03:34:04 UTC 2014
Diffstat (limited to 'core')
-rw-r--r--core/mpfr/PKGBUILD7
-rw-r--r--core/mpfr/mpfr-3.1.2-p10.patch (renamed from core/mpfr/mpfr-3.1.2-p8.patch)304
2 files changed, 308 insertions, 3 deletions
diff --git a/core/mpfr/PKGBUILD b/core/mpfr/PKGBUILD
index 4c7d4a2b4..6af9b05f6 100644
--- a/core/mpfr/PKGBUILD
+++ b/core/mpfr/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 213675 2014-05-28 05:17:32Z allan $
+# $Id: PKGBUILD 216598 2014-07-07 03:14:57Z allan $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: damir <damir@archlinux.org>
pkgname=mpfr
_pkgver=3.1.2
-_patchlevel=p8
+_patchlevel=p10
pkgver=${_pkgver}.${_patchlevel}
#pkgver=${_pkgver}
pkgrel=1
@@ -18,7 +18,8 @@ source=(http://www.mpfr.org/mpfr-current/mpfr-${_pkgver}.tar.xz{,.asc}
mpfr-${_pkgver}-${_patchlevel}.patch)
md5sums=('e3d203d188b8fe60bb6578dd3152e05c'
'SKIP'
- '3280aba9c8ebb1be9dab32d28e97e9a6')
+ '43121795ef12f1b29ada4508d9186ea9')
+validpgpkeys=('07F3DBBECC1A39605078094D980C197698C3739D')
build() {
cd "${srcdir}/${pkgname}-${_pkgver}"
diff --git a/core/mpfr/mpfr-3.1.2-p8.patch b/core/mpfr/mpfr-3.1.2-p10.patch
index 31b2c61d3..d42e62bf1 100644
--- a/core/mpfr/mpfr-3.1.2-p8.patch
+++ b/core/mpfr/mpfr-3.1.2-p10.patch
@@ -1271,3 +1271,307 @@ diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
- return "3.1.2-p7";
+ return "3.1.2-p8";
}
+diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
+--- mpfr-3.1.2-a/PATCHES 2014-06-30 15:15:25.533266905 +0000
++++ mpfr-3.1.2-b/PATCHES 2014-06-30 15:15:25.617269178 +0000
+@@ -0,0 +1 @@
++div-overflow
+diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
+--- mpfr-3.1.2-a/VERSION 2014-06-30 15:15:25.529266797 +0000
++++ mpfr-3.1.2-b/VERSION 2014-06-30 15:15:25.617269178 +0000
+@@ -1 +1 @@
+-3.1.2-p8
++3.1.2-p9
+diff -Naurd mpfr-3.1.2-a/src/div.c mpfr-3.1.2-b/src/div.c
+--- mpfr-3.1.2-a/src/div.c 2013-03-13 15:37:33.000000000 +0000
++++ mpfr-3.1.2-b/src/div.c 2014-06-30 15:15:25.585268312 +0000
+@@ -750,7 +750,9 @@
+ truncate_check_qh:
+ if (qh)
+ {
+- qexp ++;
++ if (MPFR_LIKELY (qexp < MPFR_EXP_MAX))
++ qexp ++;
++ /* else qexp is now incorrect, but one will still get an overflow */
+ q0p[q0size - 1] = MPFR_LIMB_HIGHBIT;
+ }
+ goto truncate;
+@@ -765,7 +767,9 @@
+ inex = 1; /* always here */
+ if (mpn_add_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh))
+ {
+- qexp ++;
++ if (MPFR_LIKELY (qexp < MPFR_EXP_MAX))
++ qexp ++;
++ /* else qexp is now incorrect, but one will still get an overflow */
+ q0p[q0size - 1] = MPFR_LIMB_HIGHBIT;
+ }
+
+diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
+--- mpfr-3.1.2-a/src/mpfr.h 2014-06-30 15:15:25.533266905 +0000
++++ mpfr-3.1.2-b/src/mpfr.h 2014-06-30 15:15:25.613269070 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 1
+ #define MPFR_VERSION_PATCHLEVEL 2
+-#define MPFR_VERSION_STRING "3.1.2-p8"
++#define MPFR_VERSION_STRING "3.1.2-p9"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
+--- mpfr-3.1.2-a/src/version.c 2014-06-30 15:15:25.533266905 +0000
++++ mpfr-3.1.2-b/src/version.c 2014-06-30 15:15:25.613269070 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.1.2-p8";
++ return "3.1.2-p9";
+ }
+diff -Naurd mpfr-3.1.2-a/tests/tdiv.c mpfr-3.1.2-b/tests/tdiv.c
+--- mpfr-3.1.2-a/tests/tdiv.c 2013-03-13 15:37:44.000000000 +0000
++++ mpfr-3.1.2-b/tests/tdiv.c 2014-06-30 15:15:25.585268312 +0000
+@@ -1104,6 +1104,96 @@
+ #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
+ #include "tgeneric.c"
+
++static void
++test_extreme (void)
++{
++ mpfr_t x, y, z;
++ mpfr_exp_t emin, emax;
++ mpfr_prec_t p[4] = { 8, 32, 64, 256 };
++ int xi, yi, zi, j, r;
++ unsigned int flags, ex_flags;
++
++ emin = mpfr_get_emin ();
++ emax = mpfr_get_emax ();
++
++ mpfr_set_emin (MPFR_EMIN_MIN);
++ mpfr_set_emax (MPFR_EMAX_MAX);
++
++ for (xi = 0; xi < 4; xi++)
++ {
++ mpfr_init2 (x, p[xi]);
++ mpfr_setmax (x, MPFR_EMAX_MAX);
++ MPFR_ASSERTN (mpfr_check (x));
++ for (yi = 0; yi < 4; yi++)
++ {
++ mpfr_init2 (y, p[yi]);
++ mpfr_setmin (y, MPFR_EMIN_MIN);
++ for (j = 0; j < 2; j++)
++ {
++ MPFR_ASSERTN (mpfr_check (y));
++ for (zi = 0; zi < 4; zi++)
++ {
++ mpfr_init2 (z, p[zi]);
++ RND_LOOP (r)
++ {
++ mpfr_clear_flags ();
++ mpfr_div (z, x, y, (mpfr_rnd_t) r);
++ flags = __gmpfr_flags;
++ MPFR_ASSERTN (mpfr_check (z));
++ ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT;
++ if (flags != ex_flags)
++ {
++ printf ("Bad flags in test_extreme on z = a/b"
++ " with %s and\n",
++ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
++ printf ("a = ");
++ mpfr_dump (x);
++ printf ("b = ");
++ mpfr_dump (y);
++ printf ("Expected flags:");
++ flags_out (ex_flags);
++ printf ("Got flags: ");
++ flags_out (flags);
++ printf ("z = ");
++ mpfr_dump (z);
++ exit (1);
++ }
++ mpfr_clear_flags ();
++ mpfr_div (z, y, x, (mpfr_rnd_t) r);
++ flags = __gmpfr_flags;
++ MPFR_ASSERTN (mpfr_check (z));
++ ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT;
++ if (flags != ex_flags)
++ {
++ printf ("Bad flags in test_extreme on z = a/b"
++ " with %s and\n",
++ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
++ printf ("a = ");
++ mpfr_dump (y);
++ printf ("b = ");
++ mpfr_dump (x);
++ printf ("Expected flags:");
++ flags_out (ex_flags);
++ printf ("Got flags: ");
++ flags_out (flags);
++ printf ("z = ");
++ mpfr_dump (z);
++ exit (1);
++ }
++ }
++ mpfr_clear (z);
++ } /* zi */
++ mpfr_nextabove (y);
++ } /* j */
++ mpfr_clear (y);
++ } /* yi */
++ mpfr_clear (x);
++ } /* xi */
++
++ set_emin (emin);
++ set_emax (emax);
++}
++
+ int
+ main (int argc, char *argv[])
+ {
+@@ -1130,6 +1220,7 @@
+ test_20070603 ();
+ test_20070628 ();
+ test_generic (2, 800, 50);
++ test_extreme ();
+
+ tests_end_mpfr ();
+ return 0;
+diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
+--- mpfr-3.1.2-a/PATCHES 2014-06-30 15:17:53.337268149 +0000
++++ mpfr-3.1.2-b/PATCHES 2014-06-30 15:17:53.417270314 +0000
+@@ -0,0 +1 @@
++vasprintf
+diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
+--- mpfr-3.1.2-a/VERSION 2014-06-30 15:17:53.337268149 +0000
++++ mpfr-3.1.2-b/VERSION 2014-06-30 15:17:53.413270206 +0000
+@@ -1 +1 @@
+-3.1.2-p9
++3.1.2-p10
+diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
+--- mpfr-3.1.2-a/src/mpfr.h 2014-06-30 15:17:53.337268149 +0000
++++ mpfr-3.1.2-b/src/mpfr.h 2014-06-30 15:17:53.413270206 +0000
+@@ -27,7 +27,7 @@
+ #define MPFR_VERSION_MAJOR 3
+ #define MPFR_VERSION_MINOR 1
+ #define MPFR_VERSION_PATCHLEVEL 2
+-#define MPFR_VERSION_STRING "3.1.2-p9"
++#define MPFR_VERSION_STRING "3.1.2-p10"
+
+ /* Macros dealing with MPFR VERSION */
+ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c
+--- mpfr-3.1.2-a/src/vasprintf.c 2013-11-15 00:51:49.267334408 +0000
++++ mpfr-3.1.2-b/src/vasprintf.c 2014-06-30 15:17:53.377269231 +0000
+@@ -884,14 +884,18 @@
+ first digit, we want the exponent for radix two and the decimal
+ point AFTER the first digit. */
+ {
+- MPFR_ASSERTN (exp > MPFR_EMIN_MIN /4); /* possible overflow */
++ /* An integer overflow is normally not possible since MPFR_EXP_MIN
++ is twice as large as MPFR_EMIN_MIN. */
++ MPFR_ASSERTN (exp > (MPFR_EXP_MIN + 3) / 4);
+ exp = (exp - 1) * 4;
+ }
+ else
+ /* EXP is the exponent for decimal point BEFORE the first digit, we
+ want the exponent for decimal point AFTER the first digit. */
+ {
+- MPFR_ASSERTN (exp > MPFR_EMIN_MIN); /* possible overflow */
++ /* An integer overflow is normally not possible since MPFR_EXP_MIN
++ is twice as large as MPFR_EMIN_MIN. */
++ MPFR_ASSERTN (exp > MPFR_EXP_MIN);
+ --exp;
+ }
+ }
+diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
+--- mpfr-3.1.2-a/src/version.c 2014-06-30 15:17:53.337268149 +0000
++++ mpfr-3.1.2-b/src/version.c 2014-06-30 15:17:53.413270206 +0000
+@@ -25,5 +25,5 @@
+ const char *
+ mpfr_get_version (void)
+ {
+- return "3.1.2-p9";
++ return "3.1.2-p10";
+ }
+diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c
+--- mpfr-3.1.2-a/tests/tsprintf.c 2013-11-15 00:51:49.267334408 +0000
++++ mpfr-3.1.2-b/tests/tsprintf.c 2014-06-30 15:17:53.377269231 +0000
+@@ -1184,6 +1184,69 @@
+ check_emax_aux (MPFR_EMAX_MAX);
+ }
+
++static void
++check_emin_aux (mpfr_exp_t e)
++{
++ mpfr_t x;
++ char *s1, s2[256];
++ int i;
++ mpfr_exp_t emin;
++ mpz_t ee;
++
++ MPFR_ASSERTN (e >= LONG_MIN);
++ emin = mpfr_get_emin ();
++ set_emin (e);
++
++ mpfr_init2 (x, 16);
++ mpz_init (ee);
++
++ mpfr_setmin (x, e);
++ mpz_set_si (ee, e);
++ mpz_sub_ui (ee, ee, 1);
++
++ i = mpfr_asprintf (&s1, "%Ra", x);
++ MPFR_ASSERTN (i > 0);
++
++ gmp_snprintf (s2, 256, "0x1p%Zd", ee);
++
++ if (strcmp (s1, s2) != 0)
++ {
++ printf ("Error in check_emin_aux for emin = %ld\n", (long) e);
++ printf ("Expected %s\n", s2);
++ printf ("Got %s\n", s1);
++ exit (1);
++ }
++
++ mpfr_free_str (s1);
++
++ i = mpfr_asprintf (&s1, "%Rb", x);
++ MPFR_ASSERTN (i > 0);
++
++ gmp_snprintf (s2, 256, "1p%Zd", ee);
++
++ if (strcmp (s1, s2) != 0)
++ {
++ printf ("Error in check_emin_aux for emin = %ld\n", (long) e);
++ printf ("Expected %s\n", s2);
++ printf ("Got %s\n", s1);
++ exit (1);
++ }
++
++ mpfr_free_str (s1);
++
++ mpfr_clear (x);
++ mpz_clear (ee);
++ set_emin (emin);
++}
++
++static void
++check_emin (void)
++{
++ check_emin_aux (-15);
++ check_emin_aux (mpfr_get_emin ());
++ check_emin_aux (MPFR_EMIN_MIN);
++}
++
+ int
+ main (int argc, char **argv)
+ {
+@@ -1203,6 +1266,7 @@
+ decimal ();
+ mixed ();
+ check_emax ();
++ check_emin ();
+
+ #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
+ locale_da_DK ();