Add MPFR-2.4.1.
Add patchset for MPFR 2.4.0 and 2.4.1, from upstream.
/trunk/config/gmp_mpfr/mpfr.in | 8 6 2 0 +
/trunk/patches/mpfr/2.4.0/100-printf-hh-ll.patch | 359 359 0 0 +++++++++++++++++++++++++++++
/trunk/patches/mpfr/2.4.0/110-mpfr_snprintf.patch | 176 176 0 0 ++++++++++++++
/trunk/patches/mpfr/2.4.1/100-remainder-neg.patch | 123 123 0 0 ++++++++++
/trunk/patches/mpfr/2.4.1/110-assert.patch | 45 45 0 0 ++++
5 files changed, 709 insertions(+), 2 deletions(-)
1.1 --- a/config/gmp_mpfr/mpfr.in Sun Mar 08 17:11:31 2009 +0000
1.2 +++ b/config/gmp_mpfr/mpfr.in Sun Mar 08 17:27:02 2009 +0000
1.3 @@ -14,8 +14,11 @@
1.4
1.5 config MPFR_V_2_4_0
1.6 bool
1.7 - prompt "2.4.0 (EXPERIMENTAL)"
1.8 - depends on EXPERIMENTAL
1.9 + prompt "2.4.0"
1.10 +
1.11 +config MPFR_V_2_4_1
1.12 + bool
1.13 + prompt "2.4.1"
1.14
1.15 # CT_INSERT_VERSION_ABOVE
1.16 # Don't remove above line!
1.17 @@ -26,6 +29,7 @@
1.18 default "2.3.1" if MPFR_V_2_3_1
1.19 default "2.3.2" if MPFR_V_2_3_2
1.20 default "2.4.0" if MPFR_V_2_4_0
1.21 + default "2.4.1" if MPFR_V_2_4_1
1.22 # CT_INSERT_VERSION_STRING_ABOVE
1.23 # Don't remove above line!
1.24
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/patches/mpfr/2.4.0/100-printf-hh-ll.patch Sun Mar 08 17:27:02 2009 +0000
2.3 @@ -0,0 +1,359 @@
2.4 +diff -Naurd mpfr-2.4.0-a/PATCHES mpfr-2.4.0-b/PATCHES
2.5 +--- mpfr-2.4.0-a/PATCHES 2009-01-26 12:52:01.000000000 +0000
2.6 ++++ mpfr-2.4.0-b/PATCHES 2009-02-20 17:27:44.000000000 +0000
2.7 +@@ -0,0 +1 @@
2.8 ++printf-hh-ll
2.9 +diff -Naurd mpfr-2.4.0-a/VERSION mpfr-2.4.0-b/VERSION
2.10 +--- mpfr-2.4.0-a/VERSION 2009-01-26 12:52:01.000000000 +0000
2.11 ++++ mpfr-2.4.0-b/VERSION 2009-02-20 17:27:44.000000000 +0000
2.12 +@@ -1 +1 @@
2.13 +-2.4.0
2.14 ++2.4.0-p1
2.15 +diff -Naurd mpfr-2.4.0-a/acinclude.m4 mpfr-2.4.0-b/acinclude.m4
2.16 +--- mpfr-2.4.0-a/acinclude.m4 2009-01-26 12:52:01.000000000 +0000
2.17 ++++ mpfr-2.4.0-b/acinclude.m4 2009-01-26 12:52:01.000000000 +0000
2.18 +@@ -722,6 +722,16 @@
2.19 + [AC_DEFINE([NPRINTF_J], 1, [gmp_printf cannot read intmax_t])])
2.20 + fi
2.21 +
2.22 ++MPFR_FUNC_PRINTF_SPEC([%hhd], [char], [
2.23 ++#include <gmp.h>
2.24 ++ ], [gmp_],,
2.25 ++ [AC_DEFINE([NPRINTF_HH], 1, [gmp_printf cannot use 'hh' length modifier])])
2.26 ++
2.27 ++MPFR_FUNC_PRINTF_SPEC([%lld], [long long int], [
2.28 ++#include <gmp.h>
2.29 ++ ], [gmp_],,
2.30 ++ [AC_DEFINE([NPRINTF_LL], 1, [gmp_printf cannot read long long int])])
2.31 ++
2.32 + MPFR_FUNC_PRINTF_SPEC([%.0Lf], [long double], [
2.33 + #include <gmp.h>
2.34 + ], [gmp_],,
2.35 +diff -Naurd mpfr-2.4.0-a/configure mpfr-2.4.0-b/configure
2.36 +--- mpfr-2.4.0-a/configure 2009-01-26 12:54:36.000000000 +0000
2.37 ++++ mpfr-2.4.0-b/configure 2009-02-20 17:38:36.000000000 +0000
2.38 +@@ -24874,6 +24874,170 @@
2.39 + fi
2.40 +
2.41 +
2.42 ++{ $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%hhd\"" >&5
2.43 ++$as_echo_n "checking if gmp_printf supports \"%hhd\"... " >&6; }
2.44 ++if test "$cross_compiling" = yes; then
2.45 ++ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
2.46 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2.47 ++{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
2.48 ++See \`config.log' for more details." >&5
2.49 ++$as_echo "$as_me: error: cannot run test program while cross compiling
2.50 ++See \`config.log' for more details." >&2;}
2.51 ++ { (exit 1); exit 1; }; }; }
2.52 ++else
2.53 ++ cat >conftest.$ac_ext <<_ACEOF
2.54 ++/* confdefs.h. */
2.55 ++_ACEOF
2.56 ++cat confdefs.h >>conftest.$ac_ext
2.57 ++cat >>conftest.$ac_ext <<_ACEOF
2.58 ++/* end confdefs.h. */
2.59 ++
2.60 ++#include <stdio.h>
2.61 ++
2.62 ++#include <gmp.h>
2.63 ++
2.64 ++
2.65 ++int
2.66 ++main ()
2.67 ++{
2.68 ++
2.69 ++ char s[256];
2.70 ++ char a = 0;
2.71 ++ return (gmp_sprintf (s, "%hhd", a) != 1) ? 1 : 0;
2.72 ++
2.73 ++ ;
2.74 ++ return 0;
2.75 ++}
2.76 ++_ACEOF
2.77 ++rm -f conftest$ac_exeext
2.78 ++if { (ac_try="$ac_link"
2.79 ++case "(($ac_try" in
2.80 ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2.81 ++ *) ac_try_echo=$ac_try;;
2.82 ++esac
2.83 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
2.84 ++$as_echo "$ac_try_echo") >&5
2.85 ++ (eval "$ac_link") 2>&5
2.86 ++ ac_status=$?
2.87 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
2.88 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
2.89 ++ { (case "(($ac_try" in
2.90 ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2.91 ++ *) ac_try_echo=$ac_try;;
2.92 ++esac
2.93 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
2.94 ++$as_echo "$ac_try_echo") >&5
2.95 ++ (eval "$ac_try") 2>&5
2.96 ++ ac_status=$?
2.97 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
2.98 ++ (exit $ac_status); }; }; then
2.99 ++ { $as_echo "$as_me:$LINENO: result: yes" >&5
2.100 ++$as_echo "yes" >&6; }
2.101 ++
2.102 ++else
2.103 ++ $as_echo "$as_me: program exited with status $ac_status" >&5
2.104 ++$as_echo "$as_me: failed program was:" >&5
2.105 ++sed 's/^/| /' conftest.$ac_ext >&5
2.106 ++
2.107 ++( exit $ac_status )
2.108 ++{ $as_echo "$as_me:$LINENO: result: no" >&5
2.109 ++$as_echo "no" >&6; }
2.110 ++
2.111 ++cat >>confdefs.h <<\_ACEOF
2.112 ++#define NPRINTF_HH 1
2.113 ++_ACEOF
2.114 ++
2.115 ++fi
2.116 ++rm -rf conftest.dSYM
2.117 ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
2.118 ++fi
2.119 ++
2.120 ++
2.121 ++
2.122 ++
2.123 ++
2.124 ++{ $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%lld\"" >&5
2.125 ++$as_echo_n "checking if gmp_printf supports \"%lld\"... " >&6; }
2.126 ++if test "$cross_compiling" = yes; then
2.127 ++ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
2.128 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2.129 ++{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
2.130 ++See \`config.log' for more details." >&5
2.131 ++$as_echo "$as_me: error: cannot run test program while cross compiling
2.132 ++See \`config.log' for more details." >&2;}
2.133 ++ { (exit 1); exit 1; }; }; }
2.134 ++else
2.135 ++ cat >conftest.$ac_ext <<_ACEOF
2.136 ++/* confdefs.h. */
2.137 ++_ACEOF
2.138 ++cat confdefs.h >>conftest.$ac_ext
2.139 ++cat >>conftest.$ac_ext <<_ACEOF
2.140 ++/* end confdefs.h. */
2.141 ++
2.142 ++#include <stdio.h>
2.143 ++
2.144 ++#include <gmp.h>
2.145 ++
2.146 ++
2.147 ++int
2.148 ++main ()
2.149 ++{
2.150 ++
2.151 ++ char s[256];
2.152 ++ long long int a = 0;
2.153 ++ return (gmp_sprintf (s, "%lld", a) != 1) ? 1 : 0;
2.154 ++
2.155 ++ ;
2.156 ++ return 0;
2.157 ++}
2.158 ++_ACEOF
2.159 ++rm -f conftest$ac_exeext
2.160 ++if { (ac_try="$ac_link"
2.161 ++case "(($ac_try" in
2.162 ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2.163 ++ *) ac_try_echo=$ac_try;;
2.164 ++esac
2.165 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
2.166 ++$as_echo "$ac_try_echo") >&5
2.167 ++ (eval "$ac_link") 2>&5
2.168 ++ ac_status=$?
2.169 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
2.170 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
2.171 ++ { (case "(($ac_try" in
2.172 ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2.173 ++ *) ac_try_echo=$ac_try;;
2.174 ++esac
2.175 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
2.176 ++$as_echo "$ac_try_echo") >&5
2.177 ++ (eval "$ac_try") 2>&5
2.178 ++ ac_status=$?
2.179 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
2.180 ++ (exit $ac_status); }; }; then
2.181 ++ { $as_echo "$as_me:$LINENO: result: yes" >&5
2.182 ++$as_echo "yes" >&6; }
2.183 ++
2.184 ++else
2.185 ++ $as_echo "$as_me: program exited with status $ac_status" >&5
2.186 ++$as_echo "$as_me: failed program was:" >&5
2.187 ++sed 's/^/| /' conftest.$ac_ext >&5
2.188 ++
2.189 ++( exit $ac_status )
2.190 ++{ $as_echo "$as_me:$LINENO: result: no" >&5
2.191 ++$as_echo "no" >&6; }
2.192 ++
2.193 ++cat >>confdefs.h <<\_ACEOF
2.194 ++#define NPRINTF_LL 1
2.195 ++_ACEOF
2.196 ++
2.197 ++fi
2.198 ++rm -rf conftest.dSYM
2.199 ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
2.200 ++fi
2.201 ++
2.202 ++
2.203 ++
2.204 ++
2.205 ++
2.206 + { $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%.0Lf\"" >&5
2.207 + $as_echo_n "checking if gmp_printf supports \"%.0Lf\"... " >&6; }
2.208 + if test "$cross_compiling" = yes; then
2.209 +diff -Naurd mpfr-2.4.0-a/mpfr.h mpfr-2.4.0-b/mpfr.h
2.210 +--- mpfr-2.4.0-a/mpfr.h 2009-01-26 12:52:01.000000000 +0000
2.211 ++++ mpfr-2.4.0-b/mpfr.h 2009-02-20 17:27:44.000000000 +0000
2.212 +@@ -27,7 +27,7 @@
2.213 + #define MPFR_VERSION_MAJOR 2
2.214 + #define MPFR_VERSION_MINOR 4
2.215 + #define MPFR_VERSION_PATCHLEVEL 0
2.216 +-#define MPFR_VERSION_STRING "2.4.0"
2.217 ++#define MPFR_VERSION_STRING "2.4.0-p1"
2.218 +
2.219 + /* Macros dealing with MPFR VERSION */
2.220 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
2.221 +diff -Naurd mpfr-2.4.0-a/tests/tfprintf.c mpfr-2.4.0-b/tests/tfprintf.c
2.222 +--- mpfr-2.4.0-a/tests/tfprintf.c 2009-01-26 12:52:00.000000000 +0000
2.223 ++++ mpfr-2.4.0-b/tests/tfprintf.c 2009-02-20 16:31:02.000000000 +0000
2.224 +@@ -146,6 +146,7 @@
2.225 + short sh = -1;
2.226 + unsigned short ush = 1;
2.227 + int i = -1;
2.228 ++ int j = 1;
2.229 + unsigned int ui = 1;
2.230 + long lo = -1;
2.231 + unsigned long ulo = 1;
2.232 +@@ -179,12 +180,11 @@
2.233 +
2.234 + limb[0] = limb[1] = limb[2] = ~ (mp_limb_t) 0;
2.235 +
2.236 +- check_vfprintf (fout, "a. %Ra, b. %hhu, c. %u, d. %lx%hhn", mpfr, uch, ui,
2.237 +- ulo, &uch);
2.238 +- check_length (1, uch, 28, hhu);
2.239 +- check_vfprintf (fout, "a. %hhi, b. %Rb, c. %u, d. %li%ln", sch, mpfr, i,
2.240 ++ check_vfprintf (fout, "a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
2.241 ++ check_length (1, j, 22, d);
2.242 ++ check_vfprintf (fout, "a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i,
2.243 + lo, &ulo);
2.244 +- check_length (2, ulo, 37, lu);
2.245 ++ check_length (2, ulo, 36, lu);
2.246 + check_vfprintf (fout, "a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
2.247 + check_length (3, ush, 29, hu);
2.248 + check_vfprintf (fout, "a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
2.249 +@@ -208,13 +208,18 @@
2.250 + check_length (9, sz, 30, zu);
2.251 + #endif
2.252 +
2.253 ++#ifndef NPRINTF_HH
2.254 ++ check_vfprintf (fout, "a. %hhi, b.%RA, c. %hhu%hhn", sch, mpfr, uch, &uch);
2.255 ++ check_length (10, uch, 21, hhu);
2.256 ++#endif
2.257 ++
2.258 + #if (__GNU_MP_VERSION * 10 + __GNU_MP_VERSION_MINOR) >= 42
2.259 + /* The 'M' specifier was added in gmp 4.2.0 */
2.260 + check_vfprintf (fout, "a. %Mx b. %Re%Mn", limb[0], mpfr, &limb[0]);
2.261 + if (limb[0] != 14 + BITS_PER_MP_LIMB / 4 || limb[1] != ~ (mp_limb_t) 0
2.262 + || limb[2] != ~ (mp_limb_t) 0)
2.263 + {
2.264 +- printf ("Error in test #10: mpfr_vfprintf did not print %d characters"
2.265 ++ printf ("Error in test #11: mpfr_vfprintf did not print %d characters"
2.266 + " as expected\n", 14 + (int) BITS_PER_MP_LIMB / 4);
2.267 + exit (1);
2.268 + }
2.269 +@@ -227,13 +232,13 @@
2.270 + if (limb[0] != 14 + 3 * BITS_PER_MP_LIMB / 4 || limb[1] != (mp_limb_t) 0
2.271 + || limb[2] != ~ (mp_limb_t) 0)
2.272 + {
2.273 +- printf ("Error in test #11: mpfr_vfprintf did not print %d characters"
2.274 ++ printf ("Error in test #12: mpfr_vfprintf did not print %d characters"
2.275 + " as expected\n", 14 + (int) BITS_PER_MP_LIMB / 4);
2.276 + exit (1);
2.277 + }
2.278 + #endif
2.279 +
2.280 +-#ifdef HAVE_LONG_LONG
2.281 ++#if defined(HAVE_LONG_LONG) && !defined(NPRINTF_LL)
2.282 + {
2.283 + long long llo = -1;
2.284 + unsigned long long ullo = 1;
2.285 +diff -Naurd mpfr-2.4.0-a/tests/tprintf.c mpfr-2.4.0-b/tests/tprintf.c
2.286 +--- mpfr-2.4.0-a/tests/tprintf.c 2009-01-26 12:52:00.000000000 +0000
2.287 ++++ mpfr-2.4.0-b/tests/tprintf.c 2009-02-20 16:31:02.000000000 +0000
2.288 +@@ -150,6 +150,7 @@
2.289 + short sh = -1;
2.290 + unsigned short ush = 1;
2.291 + int i = -1;
2.292 ++ int j = 1;
2.293 + unsigned int ui = 1;
2.294 + long lo = -1;
2.295 + unsigned long ulo = 1;
2.296 +@@ -178,11 +179,10 @@
2.297 + mpfr_set_f (mpfr, mpf, GMP_RNDN);
2.298 + prec = mpfr_get_prec (mpfr);
2.299 +
2.300 +- check_vprintf ("a. %Ra, b. %hhu, c. %u, d. %lx%hhn", mpfr, uch, ui, ulo,
2.301 +- &uch);
2.302 +- check_length (1, uch, 28, hhu);
2.303 +- check_vprintf ("a. %hhi, b. %Rb, c. %u, d. %li%ln", sch, mpfr, i, lo, &ulo);
2.304 +- check_length (2, ulo, 37, lu);
2.305 ++ check_vprintf ("a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
2.306 ++ check_length (1, j, 22, d);
2.307 ++ check_vprintf ("a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i, lo, &ulo);
2.308 ++ check_length (2, ulo, 36, lu);
2.309 + check_vprintf ("a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
2.310 + check_length (3, ush, 29, hu);
2.311 + check_vprintf ("a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
2.312 +@@ -204,7 +204,12 @@
2.313 + check_length (9, sz, 30, zu);
2.314 + #endif
2.315 +
2.316 +-#ifdef HAVE_LONG_LONG
2.317 ++#ifndef NPRINTF_HH
2.318 ++ check_vprintf ("a. %hhi, b. %Ra, c. %hhu%hhn", sch, mpfr, uch, &uch);
2.319 ++ check_length (10, uch, 22, hhu);
2.320 ++#endif
2.321 ++
2.322 ++#if defined(HAVE_LONG_LONG) && !defined(NPRINTF_LL)
2.323 + {
2.324 + long long llo = -1;
2.325 + unsigned long long ullo = 1;
2.326 +diff -Naurd mpfr-2.4.0-a/vasprintf.c mpfr-2.4.0-b/vasprintf.c
2.327 +--- mpfr-2.4.0-a/vasprintf.c 2009-01-26 12:52:01.000000000 +0000
2.328 ++++ mpfr-2.4.0-b/vasprintf.c 2009-02-20 16:31:02.000000000 +0000
2.329 +@@ -235,10 +235,14 @@
2.330 + break;
2.331 + case 'h':
2.332 + if (*++format == 'h')
2.333 ++#ifndef NPRINTF_HH
2.334 + {
2.335 + ++format;
2.336 + specinfo->arg_type = CHAR_ARG;
2.337 + }
2.338 ++#else
2.339 ++ specinfo->arg_type = UNSUPPORTED;
2.340 ++#endif
2.341 + else
2.342 + specinfo->arg_type = SHORT_ARG;
2.343 + break;
2.344 +@@ -246,7 +250,7 @@
2.345 + if (*++format == 'l')
2.346 + {
2.347 + ++format;
2.348 +-#ifdef HAVE_LONG_LONG
2.349 ++#if defined (HAVE_LONG_LONG) && !defined(NPRINTF_LL)
2.350 + specinfo->arg_type = LONG_LONG_ARG;
2.351 + #else
2.352 + specinfo->arg_type = UNSUPPORTED;
2.353 +diff -Naurd mpfr-2.4.0-a/version.c mpfr-2.4.0-b/version.c
2.354 +--- mpfr-2.4.0-a/version.c 2009-01-26 12:52:01.000000000 +0000
2.355 ++++ mpfr-2.4.0-b/version.c 2009-02-20 17:27:44.000000000 +0000
2.356 +@@ -25,5 +25,5 @@
2.357 + const char *
2.358 + mpfr_get_version (void)
2.359 + {
2.360 +- return "2.4.0";
2.361 ++ return "2.4.0-p1";
2.362 + }
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/patches/mpfr/2.4.0/110-mpfr_snprintf.patch Sun Mar 08 17:27:02 2009 +0000
3.3 @@ -0,0 +1,176 @@
3.4 +diff -Naurd mpfr-2.4.0-a/PATCHES mpfr-2.4.0-b/PATCHES
3.5 +--- mpfr-2.4.0-a/PATCHES 2009-02-25 13:27:38.000000000 +0000
3.6 ++++ mpfr-2.4.0-b/PATCHES 2009-02-25 13:42:26.000000000 +0000
3.7 +@@ -0,0 +1 @@
3.8 ++mpfr_snprintf
3.9 +diff -Naurd mpfr-2.4.0-a/VERSION mpfr-2.4.0-b/VERSION
3.10 +--- mpfr-2.4.0-a/VERSION 2009-02-20 17:27:44.000000000 +0000
3.11 ++++ mpfr-2.4.0-b/VERSION 2009-02-25 13:41:31.000000000 +0000
3.12 +@@ -1 +1 @@
3.13 +-2.4.0-p1
3.14 ++2.4.0-p2
3.15 +diff -Naurd mpfr-2.4.0-a/mpfr.h mpfr-2.4.0-b/mpfr.h
3.16 +--- mpfr-2.4.0-a/mpfr.h 2009-02-20 17:27:44.000000000 +0000
3.17 ++++ mpfr-2.4.0-b/mpfr.h 2009-02-25 13:41:31.000000000 +0000
3.18 +@@ -27,7 +27,7 @@
3.19 + #define MPFR_VERSION_MAJOR 2
3.20 + #define MPFR_VERSION_MINOR 4
3.21 + #define MPFR_VERSION_PATCHLEVEL 0
3.22 +-#define MPFR_VERSION_STRING "2.4.0-p1"
3.23 ++#define MPFR_VERSION_STRING "2.4.0-p2"
3.24 +
3.25 + /* Macros dealing with MPFR VERSION */
3.26 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
3.27 +diff -Naurd mpfr-2.4.0-a/printf.c mpfr-2.4.0-b/printf.c
3.28 +--- mpfr-2.4.0-a/printf.c 2009-01-26 12:52:01.000000000 +0000
3.29 ++++ mpfr-2.4.0-b/printf.c 2009-02-25 13:41:22.000000000 +0000
3.30 +@@ -154,16 +154,16 @@
3.31 + int ret;
3.32 + size_t min_size;
3.33 +
3.34 +- /* C99 allows SIZE to be null */
3.35 +- if (size == 0)
3.36 +- return 0;
3.37 +-
3.38 +- MPFR_ASSERTD (buf != NULL);
3.39 +-
3.40 + GET_STR (ret, str, fmt);
3.41 +- min_size = (size_t)ret < size ? (size_t)ret : size - 1;
3.42 +- strncpy (buf, str, min_size);
3.43 +- buf[min_size + 1] = '\0';
3.44 ++
3.45 ++ /* C99 allows SIZE to be zero */
3.46 ++ if (size != 0)
3.47 ++ {
3.48 ++ MPFR_ASSERTN (buf != NULL);
3.49 ++ min_size = (size_t)ret < size ? (size_t)ret : size - 1;
3.50 ++ strncpy (buf, str, min_size);
3.51 ++ buf[min_size] = '\0';
3.52 ++ }
3.53 +
3.54 + mpfr_free_str (str);
3.55 + return ret;
3.56 +@@ -176,16 +176,17 @@
3.57 + int ret;
3.58 + int min_size;
3.59 +
3.60 +- /* C99 allows SIZE to be null */
3.61 +- if (size == 0)
3.62 +- return 0;
3.63 ++ GET_STR_VA (ret, str, fmt, ap);
3.64 +
3.65 +- MPFR_ASSERTD (buf != NULL);
3.66 ++ /* C99 allows SIZE to be zero */
3.67 ++ if (size != 0)
3.68 ++ {
3.69 ++ MPFR_ASSERTN (buf != NULL);
3.70 ++ min_size = (size_t)ret < size ? (size_t)ret : size - 1;
3.71 ++ strncpy (buf, str, min_size);
3.72 ++ buf[min_size] = '\0';
3.73 ++ }
3.74 +
3.75 +- GET_STR_VA (ret, str, fmt, ap);
3.76 +- min_size = (size_t)ret < size ? (size_t)ret : size - 1;
3.77 +- strncpy (buf, str, min_size);
3.78 +- buf[min_size + 1] = '\0';
3.79 + mpfr_free_str (str);
3.80 + return ret;
3.81 + }
3.82 +diff -Naurd mpfr-2.4.0-a/tests/tsprintf.c mpfr-2.4.0-b/tests/tsprintf.c
3.83 +--- mpfr-2.4.0-a/tests/tsprintf.c 2009-01-26 12:52:00.000000000 +0000
3.84 ++++ mpfr-2.4.0-b/tests/tsprintf.c 2009-02-25 13:41:22.000000000 +0000
3.85 +@@ -72,21 +72,37 @@
3.86 +
3.87 + /* test mpfr_snprintf */
3.88 + p = (int) (randlimb () % n0);
3.89 +- n1 = mpfr_snprintf (buffer, p, fmt, x);
3.90 +- if ((p != 0 && n0 != n1) || (p == 0 && n1 != 0))
3.91 ++ if (p == 0 && (randlimb () & 1) == 0)
3.92 ++ {
3.93 ++ n1 = mpfr_snprintf (NULL, 0, fmt, x);
3.94 ++ }
3.95 ++ else
3.96 ++ {
3.97 ++ buffer[p] = 17;
3.98 ++ n1 = mpfr_snprintf (buffer, p, fmt, x);
3.99 ++ if (buffer[p] != 17)
3.100 ++ {
3.101 ++ printf ("Buffer overflow in mpfr_snprintf for p = %d!\n", p);
3.102 ++ exit (1);
3.103 ++ }
3.104 ++ }
3.105 ++ if (n0 != n1)
3.106 + {
3.107 + printf ("Error in mpfr_snprintf (s, %d, \"%s\", x) return value\n",
3.108 + p, fmt);
3.109 + printf ("expected: %d\ngot: %d\n", n0, n1);
3.110 + exit (1);
3.111 + }
3.112 +- if (strncmp (expected, buffer, p) != 0)
3.113 ++ if ((p > 1 && strncmp (expected, buffer, p-1) != 0)
3.114 ++ || (p == 1 && buffer[0] != '\0'))
3.115 + {
3.116 +- printf ("Error in mpfr_snprintf (s, %d, \"%s\", x);\n", p, fmt);
3.117 +- printf ("expected: \"%s\"\ngot: \"%s\"\n", expected, buffer);
3.118 ++ char part_expected[p];
3.119 ++ strncpy (part_expected, expected, p);
3.120 ++ part_expected[p-1] = '\0';
3.121 ++ printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", p, fmt);
3.122 ++ printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer);
3.123 + exit (1);
3.124 + }
3.125 +-
3.126 + return n0;
3.127 + }
3.128 +
3.129 +@@ -116,8 +132,21 @@
3.130 +
3.131 + /* test mpfr_snprintf */
3.132 + p = (int) (randlimb () % n0);
3.133 +- n1 = mpfr_vsnprintf (buffer, p, fmt, ap1);
3.134 +- if ((p != 0 && n0 != n1) || (p == 0 && n1 != 0))
3.135 ++ if (p == 0 && (randlimb () & 1) == 0)
3.136 ++ {
3.137 ++ n1 = mpfr_vsnprintf (NULL, 0, fmt, ap1);
3.138 ++ }
3.139 ++ else
3.140 ++ {
3.141 ++ buffer[p] = 17;
3.142 ++ n1 = mpfr_vsnprintf (buffer, p, fmt, ap1);
3.143 ++ if (buffer[p] != 17)
3.144 ++ {
3.145 ++ printf ("Buffer overflow in mpfr_vsnprintf for p = %d!\n", p);
3.146 ++ exit (1);
3.147 ++ }
3.148 ++ }
3.149 ++ if (n0 != n1)
3.150 + {
3.151 + printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...) return value\n",
3.152 + p, fmt);
3.153 +@@ -126,10 +155,14 @@
3.154 + va_end (ap1);
3.155 + exit (1);
3.156 + }
3.157 +- if (strncmp (expected, buffer, p) != 0)
3.158 ++ if ((p > 1 && strncmp (expected, buffer, p-1) != 0)
3.159 ++ || (p == 1 && buffer[0] != '\0'))
3.160 + {
3.161 ++ char part_expected[p];
3.162 ++ strncpy (part_expected, expected, p);
3.163 ++ part_expected[p-1] = '\0';
3.164 + printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", p, fmt);
3.165 +- printf ("expected: \"%s\"\ngot: \"%s\"\n", expected, buffer);
3.166 ++ printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer);
3.167 +
3.168 + va_end (ap1);
3.169 + exit (1);
3.170 +diff -Naurd mpfr-2.4.0-a/version.c mpfr-2.4.0-b/version.c
3.171 +--- mpfr-2.4.0-a/version.c 2009-02-20 17:27:44.000000000 +0000
3.172 ++++ mpfr-2.4.0-b/version.c 2009-02-25 13:41:31.000000000 +0000
3.173 +@@ -25,5 +25,5 @@
3.174 + const char *
3.175 + mpfr_get_version (void)
3.176 + {
3.177 +- return "2.4.0-p1";
3.178 ++ return "2.4.0-p2";
3.179 + }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/patches/mpfr/2.4.1/100-remainder-neg.patch Sun Mar 08 17:27:02 2009 +0000
4.3 @@ -0,0 +1,123 @@
4.4 +diff -Naurd mpfr-2.4.1-a/PATCHES mpfr-2.4.1-b/PATCHES
4.5 +--- mpfr-2.4.1-a/PATCHES 2009-02-20 09:43:17.000000000 +0000
4.6 ++++ mpfr-2.4.1-b/PATCHES 2009-02-27 16:56:29.000000000 +0000
4.7 +@@ -0,0 +1 @@
4.8 ++remainder-neg
4.9 +diff -Naurd mpfr-2.4.1-a/VERSION mpfr-2.4.1-b/VERSION
4.10 +--- mpfr-2.4.1-a/VERSION 2009-02-25 16:16:08.000000000 +0000
4.11 ++++ mpfr-2.4.1-b/VERSION 2009-02-27 16:55:37.000000000 +0000
4.12 +@@ -1 +1 @@
4.13 +-2.4.1
4.14 ++2.4.1-p1
4.15 +diff -Naurd mpfr-2.4.1-a/mpfr.h mpfr-2.4.1-b/mpfr.h
4.16 +--- mpfr-2.4.1-a/mpfr.h 2009-02-25 16:16:08.000000000 +0000
4.17 ++++ mpfr-2.4.1-b/mpfr.h 2009-02-27 16:55:38.000000000 +0000
4.18 +@@ -27,7 +27,7 @@
4.19 + #define MPFR_VERSION_MAJOR 2
4.20 + #define MPFR_VERSION_MINOR 4
4.21 + #define MPFR_VERSION_PATCHLEVEL 1
4.22 +-#define MPFR_VERSION_STRING "2.4.1"
4.23 ++#define MPFR_VERSION_STRING "2.4.1-p1"
4.24 +
4.25 + /* Macros dealing with MPFR VERSION */
4.26 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
4.27 +diff -Naurd mpfr-2.4.1-a/rem1.c mpfr-2.4.1-b/rem1.c
4.28 +--- mpfr-2.4.1-a/rem1.c 2009-02-20 09:43:17.000000000 +0000
4.29 ++++ mpfr-2.4.1-b/rem1.c 2009-02-27 16:55:15.000000000 +0000
4.30 +@@ -170,7 +170,12 @@
4.31 + }
4.32 +
4.33 + if (mpz_cmp_ui (r, 0) == 0)
4.34 +- inex = mpfr_set_ui (rem, 0, GMP_RNDN);
4.35 ++ {
4.36 ++ inex = mpfr_set_ui (rem, 0, GMP_RNDN);
4.37 ++ /* take into account sign of x */
4.38 ++ if (signx < 0)
4.39 ++ mpfr_neg (rem, rem, GMP_RNDN);
4.40 ++ }
4.41 + else
4.42 + {
4.43 + if (rnd_q == GMP_RNDN)
4.44 +@@ -190,6 +195,9 @@
4.45 + *quo += 1;
4.46 + }
4.47 + }
4.48 ++ /* take into account sign of x */
4.49 ++ if (signx < 0)
4.50 ++ mpz_neg (r, r);
4.51 + inex = mpfr_set_z (rem, r, rnd);
4.52 + /* if ex > ey, rem should be multiplied by 2^ey, else by 2^ex */
4.53 + MPFR_EXP (rem) += (ex > ey) ? ey : ex;
4.54 +@@ -198,13 +206,6 @@
4.55 + if (quo)
4.56 + *quo *= sign;
4.57 +
4.58 +- /* take into account sign of x */
4.59 +- if (signx < 0)
4.60 +- {
4.61 +- mpfr_neg (rem, rem, GMP_RNDN);
4.62 +- inex = -inex;
4.63 +- }
4.64 +-
4.65 + mpz_clear (mx);
4.66 + mpz_clear (my);
4.67 + mpz_clear (r);
4.68 +diff -Naurd mpfr-2.4.1-a/tests/tremquo.c mpfr-2.4.1-b/tests/tremquo.c
4.69 +--- mpfr-2.4.1-a/tests/tremquo.c 2009-02-20 09:43:15.000000000 +0000
4.70 ++++ mpfr-2.4.1-b/tests/tremquo.c 2009-02-27 16:55:15.000000000 +0000
4.71 +@@ -25,6 +25,36 @@
4.72 +
4.73 + #include "mpfr-test.h"
4.74 +
4.75 ++static void
4.76 ++bug20090227 (void)
4.77 ++{
4.78 ++ mpfr_t x, y, r1, r2;
4.79 ++ int inex1, inex2;
4.80 ++
4.81 ++ mpfr_init2 (x, 118);
4.82 ++ mpfr_init2 (y, 181);
4.83 ++ mpfr_init2 (r1, 140);
4.84 ++ mpfr_init2 (r2, 140);
4.85 ++ mpfr_set_si (x, -1, GMP_RNDN);
4.86 ++ mpfr_set_str_binary (y, "1.100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001000100010100110011111010");
4.87 ++ inex1 = mpfr_remainder (r1, x, y, GMP_RNDU);
4.88 ++ /* since the quotient is -1, r1 is the rounding of x+y */
4.89 ++ inex2 = mpfr_add (r2, x, y, GMP_RNDU);
4.90 ++ if (mpfr_cmp (r1, r2))
4.91 ++ {
4.92 ++ printf ("Error in mpfr_remainder (bug20090227)\n");
4.93 ++ printf ("Expected ");
4.94 ++ mpfr_dump (r2);
4.95 ++ printf ("Got ");
4.96 ++ mpfr_dump (r1);
4.97 ++ exit (1);
4.98 ++ }
4.99 ++ mpfr_clear (x);
4.100 ++ mpfr_clear (y);
4.101 ++ mpfr_clear (r1);
4.102 ++ mpfr_clear (r2);
4.103 ++}
4.104 ++
4.105 + int
4.106 + main (int argc, char *argv[])
4.107 + {
4.108 +@@ -50,6 +80,8 @@
4.109 +
4.110 + tests_start_mpfr ();
4.111 +
4.112 ++ bug20090227 ();
4.113 ++
4.114 + mpfr_init (x);
4.115 + mpfr_init (y);
4.116 + mpfr_init (r);
4.117 +diff -Naurd mpfr-2.4.1-a/version.c mpfr-2.4.1-b/version.c
4.118 +--- mpfr-2.4.1-a/version.c 2009-02-25 16:16:08.000000000 +0000
4.119 ++++ mpfr-2.4.1-b/version.c 2009-02-27 16:55:38.000000000 +0000
4.120 +@@ -25,5 +25,5 @@
4.121 + const char *
4.122 + mpfr_get_version (void)
4.123 + {
4.124 +- return "2.4.1";
4.125 ++ return "2.4.1-p1";
4.126 + }
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/patches/mpfr/2.4.1/110-assert.patch Sun Mar 08 17:27:02 2009 +0000
5.3 @@ -0,0 +1,45 @@
5.4 +diff -Naurd mpfr-2.4.1-a/PATCHES mpfr-2.4.1-b/PATCHES
5.5 +--- mpfr-2.4.1-a/PATCHES 2009-03-04 13:15:05.000000000 +0000
5.6 ++++ mpfr-2.4.1-b/PATCHES 2009-03-04 13:17:04.000000000 +0000
5.7 +@@ -0,0 +1 @@
5.8 ++assert
5.9 +diff -Naurd mpfr-2.4.1-a/VERSION mpfr-2.4.1-b/VERSION
5.10 +--- mpfr-2.4.1-a/VERSION 2009-02-27 16:55:37.000000000 +0000
5.11 ++++ mpfr-2.4.1-b/VERSION 2009-03-04 13:16:46.000000000 +0000
5.12 +@@ -1 +1 @@
5.13 +-2.4.1-p1
5.14 ++2.4.1-p2
5.15 +diff -Naurd mpfr-2.4.1-a/mpfr-gmp.c mpfr-2.4.1-b/mpfr-gmp.c
5.16 +--- mpfr-2.4.1-a/mpfr-gmp.c 2009-02-20 09:43:17.000000000 +0000
5.17 ++++ mpfr-2.4.1-b/mpfr-gmp.c 2009-03-04 13:16:39.000000000 +0000
5.18 +@@ -301,7 +301,7 @@
5.19 + if (linenum != -1)
5.20 + fprintf (stderr, "%d: ", linenum);
5.21 + }
5.22 +- fprintf (stderr, " assertion failed: %s\n", expr);
5.23 ++ fprintf (stderr, "MPFR assertion failed: %s\n", expr);
5.24 + abort();
5.25 + }
5.26 +
5.27 +diff -Naurd mpfr-2.4.1-a/mpfr.h mpfr-2.4.1-b/mpfr.h
5.28 +--- mpfr-2.4.1-a/mpfr.h 2009-02-27 16:55:38.000000000 +0000
5.29 ++++ mpfr-2.4.1-b/mpfr.h 2009-03-04 13:16:46.000000000 +0000
5.30 +@@ -27,7 +27,7 @@
5.31 + #define MPFR_VERSION_MAJOR 2
5.32 + #define MPFR_VERSION_MINOR 4
5.33 + #define MPFR_VERSION_PATCHLEVEL 1
5.34 +-#define MPFR_VERSION_STRING "2.4.1-p1"
5.35 ++#define MPFR_VERSION_STRING "2.4.1-p2"
5.36 +
5.37 + /* Macros dealing with MPFR VERSION */
5.38 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
5.39 +diff -Naurd mpfr-2.4.1-a/version.c mpfr-2.4.1-b/version.c
5.40 +--- mpfr-2.4.1-a/version.c 2009-02-27 16:55:38.000000000 +0000
5.41 ++++ mpfr-2.4.1-b/version.c 2009-03-04 13:16:46.000000000 +0000
5.42 +@@ -25,5 +25,5 @@
5.43 + const char *
5.44 + mpfr_get_version (void)
5.45 + {
5.46 +- return "2.4.1-p1";
5.47 ++ return "2.4.1-p2";
5.48 + }