wok rev 17581
Up: elfutils 0.161
author | Alexander Medvedev <devl547@gmail.com> |
---|---|
date | Sun Feb 08 18:13:43 2015 +0000 (2015-02-08) |
parents | 63c5da92bdb1 |
children | e1141f224d98 |
files | elfutils-dev/receipt elfutils/receipt mpfr/stuff/mpfr-3.1.2-upstream_fixes-3.patch |
line diff
1.1 --- a/elfutils-dev/receipt Sun Feb 08 18:11:18 2015 +0000 1.2 +++ b/elfutils-dev/receipt Sun Feb 08 18:13:43 2015 +0000 1.3 @@ -1,7 +1,7 @@ 1.4 # SliTaz package receipt. 1.5 1.6 PACKAGE="elfutils-dev" 1.7 -VERSION="0.153" 1.8 +VERSION="0.161" 1.9 CATEGORY="development" 1.10 SHORT_DESC="ELF object file access library, development files." 1.11 MAINTAINER="pascal.bellard@slitaz.org"
2.1 --- a/elfutils/receipt Sun Feb 08 18:11:18 2015 +0000 2.2 +++ b/elfutils/receipt Sun Feb 08 18:13:43 2015 +0000 2.3 @@ -1,7 +1,7 @@ 2.4 # SliTaz package receipt. 2.5 2.6 PACKAGE="elfutils" 2.7 -VERSION="0.153" 2.8 +VERSION="0.161" 2.9 CATEGORY="development" 2.10 SHORT_DESC="ELF object file access library." 2.11 MAINTAINER="pascal.bellard@slitaz.org" 2.12 @@ -23,18 +23,8 @@ 2.13 compile_rules() 2.14 { 2.15 cd $src 2.16 - mkdir -p src/.deps 2.17 - touch src/.deps/none_ld.Po 2.18 - sed -i -e 's/strcmp.*symtab")/(&\n\t\t\t\t\&\& strcmp (section_name (ebl, idx), ".dynsym"))/' \ 2.19 - -e 's/__fini_array_start.*/&\n\t\t\t\t\&\& strcmp (name, "__bss_start") != 0\n\t\t\t\t\&\& strcmp (name, "__TMC_END__") != 0/' \ 2.20 - src/elflint.c 2.21 - sed -i 's/run-strip-reloc.sh//' tests/Makefile* # Need cc -g ! 2.22 ./configure $CONFIGURE_ARGS && 2.23 - # Disable check/tests when cross-compiling 2.24 - case "$ARCH" in 2.25 - arm) make && make install ;; 2.26 - *) make && make check && make install ;; 2.27 - esac 2.28 + make && make install 2.29 } 2.30 2.31 # Rules to gen a SliTaz package suitable for Tazpkg.
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/mpfr/stuff/mpfr-3.1.2-upstream_fixes-3.patch Sun Feb 08 18:13:43 2015 +0000 3.3 @@ -0,0 +1,1199 @@ 3.4 +Submitted By: Bruce Dubbs <bdubbs_at_linuxfromscratch_dot_org> 3.5 +Updated By: Armin K. <krejzi at email dot com> 3.6 +Date: 2015-02-06 3.7 +Initial Package Version: 3.1.2 3.8 +Upstream Status: Already in upstream patch repo 3.9 +Origin: Upstream 3.10 +Description: This patch contains patches for several bugs in MPFR. 3.11 + Note that the patch for configure.ac has been 3.12 + removed to prevent unneeded regeneration of build 3.13 + files. 3.14 + See http://www.mpfr.org/mpfr-current/allpatches 3.15 + 3.16 +--- a/PATCHES 2013-03-13 16:37:38.000000000 +0100 3.17 ++++ b/PATCHES 2014-12-31 14:56:02.685641958 +0100 3.18 +@@ -0,0 +1,11 @@ 3.19 ++strtofr 3.20 ++vasprintf 3.21 ++div-overflow 3.22 ++gmp6-compat 3.23 ++exp3 3.24 ++li2-return 3.25 ++custom_init_set 3.26 ++printf-alt0 3.27 ++clang-divby0 3.28 ++fits-smallneg 3.29 ++exp_2 3.30 +--- a/src/div.c 2013-03-13 16:37:33.000000000 +0100 3.31 ++++ b/src/div.c 2014-12-31 14:56:02.686641971 +0100 3.32 +@@ -750,7 +750,9 @@ 3.33 + truncate_check_qh: 3.34 + if (qh) 3.35 + { 3.36 +- qexp ++; 3.37 ++ if (MPFR_LIKELY (qexp < MPFR_EXP_MAX)) 3.38 ++ qexp ++; 3.39 ++ /* else qexp is now incorrect, but one will still get an overflow */ 3.40 + q0p[q0size - 1] = MPFR_LIMB_HIGHBIT; 3.41 + } 3.42 + goto truncate; 3.43 +@@ -765,7 +767,9 @@ 3.44 + inex = 1; /* always here */ 3.45 + if (mpn_add_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh)) 3.46 + { 3.47 +- qexp ++; 3.48 ++ if (MPFR_LIKELY (qexp < MPFR_EXP_MAX)) 3.49 ++ qexp ++; 3.50 ++ /* else qexp is now incorrect, but one will still get an overflow */ 3.51 + q0p[q0size - 1] = MPFR_LIMB_HIGHBIT; 3.52 + } 3.53 + 3.54 +--- a/src/exp_2.c 2013-03-13 16:37:28.000000000 +0100 3.55 ++++ b/src/exp_2.c 2014-12-31 14:56:02.686641971 +0100 3.56 +@@ -204,7 +204,7 @@ 3.57 + for (k = 0; k < K; k++) 3.58 + { 3.59 + mpz_mul (ss, ss, ss); 3.60 +- exps <<= 1; 3.61 ++ exps *= 2; 3.62 + exps += mpz_normalize (ss, ss, q); 3.63 + } 3.64 + mpfr_set_z (s, ss, MPFR_RNDN); 3.65 +--- a/src/exp3.c 2013-03-13 16:37:34.000000000 +0100 3.66 ++++ b/src/exp3.c 2014-12-31 14:56:02.686641971 +0100 3.67 +@@ -283,7 +283,7 @@ 3.68 + } 3.69 + } 3.70 + 3.71 +- if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDD, MPFR_RNDZ, 3.72 ++ if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDN, MPFR_RNDZ, 3.73 + MPFR_PREC(y) + (rnd_mode == MPFR_RNDN))) 3.74 + { 3.75 + inexact = mpfr_set (y, shift_x > 0 ? t : tmp, rnd_mode); 3.76 +--- a/src/fits_u.h 2013-03-13 16:37:35.000000000 +0100 3.77 ++++ b/src/fits_u.h 2014-12-31 14:56:02.686641971 +0100 3.78 +@@ -32,17 +32,20 @@ 3.79 + int res; 3.80 + 3.81 + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) 3.82 +- /* Zero always fit */ 3.83 +- return MPFR_IS_ZERO (f) ? 1 : 0; 3.84 +- else if (MPFR_IS_NEG (f)) 3.85 +- /* Negative numbers don't fit */ 3.86 +- return 0; 3.87 +- /* now it fits if 3.88 +- (a) f <= MAXIMUM 3.89 +- (b) round(f, prec(slong), rnd) <= MAXIMUM */ 3.90 ++ return MPFR_IS_ZERO (f) ? 1 : 0; /* Zero always fits */ 3.91 + 3.92 + e = MPFR_GET_EXP (f); 3.93 + 3.94 ++ if (MPFR_IS_NEG (f)) 3.95 ++ return e >= 1 ? 0 /* f <= -1 does not fit */ 3.96 ++ : rnd != MPFR_RNDN ? MPFR_IS_LIKE_RNDU (rnd, -1) /* directed mode */ 3.97 ++ : e < 0 ? 1 /* f > -1/2 fits in MPFR_RNDN */ 3.98 ++ : mpfr_powerof2_raw(f); /* -1/2 fits, -1 < f < -1/2 don't */ 3.99 ++ 3.100 ++ /* Now it fits if 3.101 ++ (a) f <= MAXIMUM 3.102 ++ (b) round(f, prec(slong), rnd) <= MAXIMUM */ 3.103 ++ 3.104 + /* first compute prec(MAXIMUM); fits in an int */ 3.105 + for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++); 3.106 + 3.107 +--- a/src/fits_uintmax.c 2013-03-13 16:37:33.000000000 +0100 3.108 ++++ b/src/fits_uintmax.c 2014-12-31 14:56:02.686641971 +0100 3.109 +@@ -27,51 +27,19 @@ 3.110 + #include "mpfr-intmax.h" 3.111 + #include "mpfr-impl.h" 3.112 + 3.113 +-#ifdef _MPFR_H_HAVE_INTMAX_T 3.114 +- 3.115 +-/* We can't use fits_u.h <= mpfr_cmp_ui */ 3.116 +-int 3.117 +-mpfr_fits_uintmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) 3.118 +-{ 3.119 +- mpfr_exp_t e; 3.120 +- int prec; 3.121 +- uintmax_t s; 3.122 +- mpfr_t x; 3.123 +- int res; 3.124 +- 3.125 +- if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) 3.126 +- /* Zero always fit */ 3.127 +- return MPFR_IS_ZERO (f) ? 1 : 0; 3.128 +- else if (MPFR_IS_NEG (f)) 3.129 +- /* Negative numbers don't fit */ 3.130 +- return 0; 3.131 +- /* now it fits if 3.132 +- (a) f <= MAXIMUM 3.133 +- (b) round(f, prec(slong), rnd) <= MAXIMUM */ 3.134 +- 3.135 +- e = MPFR_GET_EXP (f); 3.136 ++/* Note: though mpfr-impl.h is included in fits_u.h, we also include it 3.137 ++ above so that it gets included even when _MPFR_H_HAVE_INTMAX_T is not 3.138 ++ defined; this is necessary to avoid an empty translation unit, which 3.139 ++ is forbidden by ISO C. Without this, a failing test can be reproduced 3.140 ++ by creating an invalid stdint.h somewhere in the default include path 3.141 ++ and by compiling MPFR with "gcc -ansi -pedantic-errors". */ 3.142 + 3.143 +- /* first compute prec(MAXIMUM); fits in an int */ 3.144 +- for (s = MPFR_UINTMAX_MAX, prec = 0; s != 0; s /= 2, prec ++); 3.145 +- 3.146 +- /* MAXIMUM needs prec bits, i.e. MAXIMUM = 2^prec - 1 */ 3.147 +- 3.148 +- /* if e <= prec - 1, then f < 2^(prec-1) < MAXIMUM */ 3.149 +- if (e <= prec - 1) 3.150 +- return 1; 3.151 +- 3.152 +- /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */ 3.153 +- if (e >= prec + 1) 3.154 +- return 0; 3.155 ++#ifdef _MPFR_H_HAVE_INTMAX_T 3.156 + 3.157 +- MPFR_ASSERTD (e == prec); 3.158 ++#define FUNCTION mpfr_fits_uintmax_p 3.159 ++#define MAXIMUM MPFR_UINTMAX_MAX 3.160 ++#define TYPE uintmax_t 3.161 + 3.162 +- /* hard case: first round to prec bits, then check */ 3.163 +- mpfr_init2 (x, prec); 3.164 +- mpfr_set (x, f, rnd); 3.165 +- res = MPFR_GET_EXP (x) == e; 3.166 +- mpfr_clear (x); 3.167 +- return res; 3.168 +-} 3.169 ++#include "fits_u.h" 3.170 + 3.171 + #endif 3.172 +--- a/src/init2.c 2013-03-13 16:37:32.000000000 +0100 3.173 ++++ b/src/init2.c 2014-12-31 14:56:02.686641971 +0100 3.174 +@@ -30,11 +30,11 @@ 3.175 + 3.176 + /* Check if we can represent the number of limbs 3.177 + * associated to the maximum of mpfr_prec_t*/ 3.178 +- MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/BYTES_PER_MP_LIMB) ); 3.179 ++ MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/MPFR_BYTES_PER_MP_LIMB) ); 3.180 + 3.181 +- /* Check for correct GMP_NUMB_BITS and BYTES_PER_MP_LIMB */ 3.182 +- MPFR_ASSERTN( GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT 3.183 +- && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ); 3.184 ++ /* Check for correct GMP_NUMB_BITS and MPFR_BYTES_PER_MP_LIMB */ 3.185 ++ MPFR_ASSERTN( GMP_NUMB_BITS == MPFR_BYTES_PER_MP_LIMB * CHAR_BIT 3.186 ++ && sizeof(mp_limb_t) == MPFR_BYTES_PER_MP_LIMB ); 3.187 + 3.188 + MPFR_ASSERTN (mp_bits_per_limb == GMP_NUMB_BITS); 3.189 + 3.190 +--- a/src/li2.c 2013-03-13 16:37:32.000000000 +0100 3.191 ++++ b/src/li2.c 2014-12-31 14:56:02.686641971 +0100 3.192 +@@ -630,5 +630,5 @@ 3.193 + return mpfr_check_range (y, inexact, rnd_mode); 3.194 + } 3.195 + 3.196 +- MPFR_ASSERTN (0); /* should never reach this point */ 3.197 ++ MPFR_RET_NEVER_GO_HERE (); 3.198 + } 3.199 +--- a/src/mpfr-gmp.h 2013-03-13 16:37:32.000000000 +0100 3.200 ++++ b/src/mpfr-gmp.h 2014-12-31 14:56:02.687641984 +0100 3.201 +@@ -72,7 +72,6 @@ 3.202 + #endif 3.203 + 3.204 + /* Define some macros */ 3.205 +-#define BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT) 3.206 + 3.207 + #define MP_LIMB_T_MAX (~(mp_limb_t)0) 3.208 + 3.209 +@@ -96,19 +95,19 @@ 3.210 + #define SHRT_HIGHBIT SHRT_MIN 3.211 + 3.212 + /* MP_LIMB macros */ 3.213 +-#define MPN_ZERO(dst, n) memset((dst), 0, (n)*BYTES_PER_MP_LIMB) 3.214 +-#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB) 3.215 +-#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB) 3.216 ++#define MPN_ZERO(dst, n) memset((dst), 0, (n)*MPFR_BYTES_PER_MP_LIMB) 3.217 ++#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) 3.218 ++#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) 3.219 + #define MPN_COPY(dst,src,n) \ 3.220 + do \ 3.221 + { \ 3.222 + if ((dst) != (src)) \ 3.223 + { \ 3.224 + MPFR_ASSERTD ((char *) (dst) >= (char *) (src) + \ 3.225 +- (n) * BYTES_PER_MP_LIMB || \ 3.226 ++ (n) * MPFR_BYTES_PER_MP_LIMB || \ 3.227 + (char *) (src) >= (char *) (dst) + \ 3.228 +- (n) * BYTES_PER_MP_LIMB); \ 3.229 +- memcpy ((dst), (src), (n) * BYTES_PER_MP_LIMB); \ 3.230 ++ (n) * MPFR_BYTES_PER_MP_LIMB); \ 3.231 ++ memcpy ((dst), (src), (n) * MPFR_BYTES_PER_MP_LIMB); \ 3.232 + } \ 3.233 + } \ 3.234 + while (0) 3.235 +--- a/src/mpfr.h 2013-03-13 16:37:37.000000000 +0100 3.236 ++++ b/src/mpfr.h 2014-12-31 14:56:02.687641984 +0100 3.237 +@@ -27,7 +27,7 @@ 3.238 + #define MPFR_VERSION_MAJOR 3 3.239 + #define MPFR_VERSION_MINOR 1 3.240 + #define MPFR_VERSION_PATCHLEVEL 2 3.241 +-#define MPFR_VERSION_STRING "3.1.2" 3.242 ++#define MPFR_VERSION_STRING "3.1.2-p11" 3.243 + 3.244 + /* Macros dealing with MPFR VERSION */ 3.245 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 3.246 +@@ -861,7 +861,7 @@ 3.247 + _t = (mpfr_kind_t) _k; \ 3.248 + _s = 1; \ 3.249 + } else { \ 3.250 +- _t = (mpfr_kind_t) -k; \ 3.251 ++ _t = (mpfr_kind_t) - _k; \ 3.252 + _s = -1; \ 3.253 + } \ 3.254 + _e = _t == MPFR_REGULAR_KIND ? (e) : \ 3.255 +--- a/src/mpfr-impl.h 2013-03-13 16:37:36.000000000 +0100 3.256 ++++ b/src/mpfr-impl.h 2014-12-31 14:56:02.687641984 +0100 3.257 +@@ -191,7 +191,7 @@ 3.258 + # endif 3.259 + #endif 3.260 + 3.261 +- 3.262 ++#define MPFR_BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT) 3.263 + 3.264 + /****************************************************** 3.265 + ******************** Check GMP *********************** 3.266 +@@ -468,8 +468,16 @@ 3.267 + #define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1) 3.268 + 3.269 + /* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0 3.270 +- at compile time. */ 3.271 +-#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200) 3.272 ++ at compile time. 3.273 ++ Clang with -fsanitize=undefined is a bit similar due to a bug: 3.274 ++ http://llvm.org/bugs/show_bug.cgi?id=17381 3.275 ++ but even without its sanitizer, it may be better to use the 3.276 ++ double_zero version until IEEE 754 division by zero is properly 3.277 ++ supported: 3.278 ++ http://llvm.org/bugs/show_bug.cgi?id=17000 3.279 ++*/ 3.280 ++#if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \ 3.281 ++ defined(__clang__) 3.282 + static double double_zero = 0.0; 3.283 + # define DBL_NAN (double_zero/double_zero) 3.284 + # define DBL_POS_INF ((double) 1.0/double_zero) 3.285 +@@ -501,6 +509,8 @@ 3.286 + (with Xcode 2.4.1, i.e. the latest one). */ 3.287 + #define LVALUE(x) (&(x) == &(x) || &(x) != &(x)) 3.288 + #define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX)) 3.289 ++/* The DOUBLE_ISNAN(x) macro is also valid on long double x 3.290 ++ (assuming that the compiler isn't too broken). */ 3.291 + #ifdef MPFR_NANISNAN 3.292 + /* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations. 3.293 + The + must not be replaced by a ||. With gcc -ffast-math, NaN is 3.294 +@@ -920,7 +930,7 @@ 3.295 + #define MPFR_SET_ALLOC_SIZE(x, n) \ 3.296 + ( ((mp_size_t*) MPFR_MANT(x))[-1] = n) 3.297 + #define MPFR_MALLOC_SIZE(s) \ 3.298 +- ( sizeof(mpfr_size_limb_t) + BYTES_PER_MP_LIMB * ((size_t) s) ) 3.299 ++ ( sizeof(mpfr_size_limb_t) + MPFR_BYTES_PER_MP_LIMB * ((size_t) s) ) 3.300 + #define MPFR_SET_MANT_PTR(x,p) \ 3.301 + (MPFR_MANT(x) = (mp_limb_t*) ((mpfr_size_limb_t*) p + 1)) 3.302 + #define MPFR_GET_REAL_PTR(x) \ 3.303 +@@ -954,7 +964,7 @@ 3.304 + #endif 3.305 + 3.306 + #define MPFR_TMP_LIMBS_ALLOC(N) \ 3.307 +- ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * BYTES_PER_MP_LIMB)) 3.308 ++ ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * MPFR_BYTES_PER_MP_LIMB)) 3.309 + 3.310 + /* temporary allocate 1 limb at xp, and initialize mpfr variable x */ 3.311 + /* The temporary var doesn't have any size field, but it doesn't matter 3.312 +--- a/src/mul.c 2013-03-13 16:37:37.000000000 +0100 3.313 ++++ b/src/mul.c 2014-12-31 14:56:02.688641997 +0100 3.314 +@@ -106,7 +106,7 @@ 3.315 + MPFR_ASSERTD(tn <= k); 3.316 + 3.317 + /* Check for no size_t overflow*/ 3.318 +- MPFR_ASSERTD((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB); 3.319 ++ MPFR_ASSERTD((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB); 3.320 + MPFR_TMP_MARK(marker); 3.321 + tmp = MPFR_TMP_LIMBS_ALLOC (k); 3.322 + 3.323 +@@ -301,7 +301,7 @@ 3.324 + MPFR_ASSERTD (tn <= k); /* tn <= k, thus no int overflow */ 3.325 + 3.326 + /* Check for no size_t overflow*/ 3.327 +- MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB); 3.328 ++ MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB); 3.329 + MPFR_TMP_MARK (marker); 3.330 + tmp = MPFR_TMP_LIMBS_ALLOC (k); 3.331 + 3.332 +--- a/src/stack_interface.c 2013-03-13 16:37:32.000000000 +0100 3.333 ++++ b/src/stack_interface.c 2014-12-31 14:56:02.688641997 +0100 3.334 +@@ -26,7 +26,7 @@ 3.335 + size_t 3.336 + mpfr_custom_get_size (mpfr_prec_t prec) 3.337 + { 3.338 +- return MPFR_PREC2LIMBS (prec) * BYTES_PER_MP_LIMB; 3.339 ++ return MPFR_PREC2LIMBS (prec) * MPFR_BYTES_PER_MP_LIMB; 3.340 + } 3.341 + 3.342 + #undef mpfr_custom_init 3.343 +--- a/src/strtofr.c 2013-03-13 16:37:32.000000000 +0100 3.344 ++++ b/src/strtofr.c 2014-12-31 14:56:02.688641997 +0100 3.345 +@@ -473,8 +473,10 @@ 3.346 + /* prec bits corresponds to ysize limbs */ 3.347 + ysize_bits = ysize * GMP_NUMB_BITS; 3.348 + /* and to ysize_bits >= prec > MPFR_PREC (x) bits */ 3.349 +- y = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 1); 3.350 +- y += ysize; /* y has (ysize+1) allocated limbs */ 3.351 ++ /* we need to allocate one more limb to work around bug 3.352 ++ https://gmplib.org/list-archives/gmp-bugs/2013-December/003267.html */ 3.353 ++ y = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 2); 3.354 ++ y += ysize; /* y has (ysize+2) allocated limbs */ 3.355 + 3.356 + /* pstr_size is the number of characters we read in pstr->mant 3.357 + to have at least ysize full limbs. 3.358 +--- a/src/vasprintf.c 2013-03-13 16:37:37.000000000 +0100 3.359 ++++ b/src/vasprintf.c 2014-12-31 14:56:02.688641997 +0100 3.360 +@@ -884,14 +884,18 @@ 3.361 + first digit, we want the exponent for radix two and the decimal 3.362 + point AFTER the first digit. */ 3.363 + { 3.364 +- MPFR_ASSERTN (exp > MPFR_EMIN_MIN /4); /* possible overflow */ 3.365 ++ /* An integer overflow is normally not possible since MPFR_EXP_MIN 3.366 ++ is twice as large as MPFR_EMIN_MIN. */ 3.367 ++ MPFR_ASSERTN (exp > (MPFR_EXP_MIN + 3) / 4); 3.368 + exp = (exp - 1) * 4; 3.369 + } 3.370 + else 3.371 + /* EXP is the exponent for decimal point BEFORE the first digit, we 3.372 + want the exponent for decimal point AFTER the first digit. */ 3.373 + { 3.374 +- MPFR_ASSERTN (exp > MPFR_EMIN_MIN); /* possible overflow */ 3.375 ++ /* An integer overflow is normally not possible since MPFR_EXP_MIN 3.376 ++ is twice as large as MPFR_EMIN_MIN. */ 3.377 ++ MPFR_ASSERTN (exp > MPFR_EXP_MIN); 3.378 + --exp; 3.379 + } 3.380 + } 3.381 +@@ -1040,7 +1044,7 @@ 3.382 + } 3.383 + 3.384 + /* Determine the different parts of the string representation of the regular 3.385 +- number P when SPEC.SPEC is 'e', 'E', 'g', or 'G'. 3.386 ++ number P when spec.spec is 'e', 'E', 'g', or 'G'. 3.387 + DEC_INFO contains the previously computed exponent and string or is NULL. 3.388 + 3.389 + return -1 if some field > INT_MAX */ 3.390 +@@ -1167,7 +1171,7 @@ 3.391 + } 3.392 + 3.393 + /* Determine the different parts of the string representation of the regular 3.394 +- number P when SPEC.SPEC is 'f', 'F', 'g', or 'G'. 3.395 ++ number P when spec.spec is 'f', 'F', 'g', or 'G'. 3.396 + DEC_INFO contains the previously computed exponent and string or is NULL. 3.397 + 3.398 + return -1 if some field of number_parts is greater than INT_MAX */ 3.399 +@@ -1559,7 +1563,7 @@ 3.400 + /* fractional part */ 3.401 + { 3.402 + np->point = MPFR_DECIMAL_POINT; 3.403 +- np->fp_trailing_zeros = (spec.spec == 'g' && spec.spec == 'G') ? 3.404 ++ np->fp_trailing_zeros = (spec.spec == 'g' || spec.spec == 'G') ? 3.405 + spec.prec - 1 : spec.prec; 3.406 + } 3.407 + else if (spec.alt) 3.408 +--- a/src/version.c 2013-03-13 16:37:34.000000000 +0100 3.409 ++++ b/src/version.c 2014-12-31 14:56:02.688641997 +0100 3.410 +@@ -25,5 +25,5 @@ 3.411 + const char * 3.412 + mpfr_get_version (void) 3.413 + { 3.414 +- return "3.1.2"; 3.415 ++ return "3.1.2-p11"; 3.416 + } 3.417 +--- a/tests/tdiv.c 2013-03-13 16:37:44.000000000 +0100 3.418 ++++ b/tests/tdiv.c 2014-12-31 14:56:02.689642010 +0100 3.419 +@@ -1104,6 +1104,96 @@ 3.420 + #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS) 3.421 + #include "tgeneric.c" 3.422 + 3.423 ++static void 3.424 ++test_extreme (void) 3.425 ++{ 3.426 ++ mpfr_t x, y, z; 3.427 ++ mpfr_exp_t emin, emax; 3.428 ++ mpfr_prec_t p[4] = { 8, 32, 64, 256 }; 3.429 ++ int xi, yi, zi, j, r; 3.430 ++ unsigned int flags, ex_flags; 3.431 ++ 3.432 ++ emin = mpfr_get_emin (); 3.433 ++ emax = mpfr_get_emax (); 3.434 ++ 3.435 ++ mpfr_set_emin (MPFR_EMIN_MIN); 3.436 ++ mpfr_set_emax (MPFR_EMAX_MAX); 3.437 ++ 3.438 ++ for (xi = 0; xi < 4; xi++) 3.439 ++ { 3.440 ++ mpfr_init2 (x, p[xi]); 3.441 ++ mpfr_setmax (x, MPFR_EMAX_MAX); 3.442 ++ MPFR_ASSERTN (mpfr_check (x)); 3.443 ++ for (yi = 0; yi < 4; yi++) 3.444 ++ { 3.445 ++ mpfr_init2 (y, p[yi]); 3.446 ++ mpfr_setmin (y, MPFR_EMIN_MIN); 3.447 ++ for (j = 0; j < 2; j++) 3.448 ++ { 3.449 ++ MPFR_ASSERTN (mpfr_check (y)); 3.450 ++ for (zi = 0; zi < 4; zi++) 3.451 ++ { 3.452 ++ mpfr_init2 (z, p[zi]); 3.453 ++ RND_LOOP (r) 3.454 ++ { 3.455 ++ mpfr_clear_flags (); 3.456 ++ mpfr_div (z, x, y, (mpfr_rnd_t) r); 3.457 ++ flags = __gmpfr_flags; 3.458 ++ MPFR_ASSERTN (mpfr_check (z)); 3.459 ++ ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; 3.460 ++ if (flags != ex_flags) 3.461 ++ { 3.462 ++ printf ("Bad flags in test_extreme on z = a/b" 3.463 ++ " with %s and\n", 3.464 ++ mpfr_print_rnd_mode ((mpfr_rnd_t) r)); 3.465 ++ printf ("a = "); 3.466 ++ mpfr_dump (x); 3.467 ++ printf ("b = "); 3.468 ++ mpfr_dump (y); 3.469 ++ printf ("Expected flags:"); 3.470 ++ flags_out (ex_flags); 3.471 ++ printf ("Got flags: "); 3.472 ++ flags_out (flags); 3.473 ++ printf ("z = "); 3.474 ++ mpfr_dump (z); 3.475 ++ exit (1); 3.476 ++ } 3.477 ++ mpfr_clear_flags (); 3.478 ++ mpfr_div (z, y, x, (mpfr_rnd_t) r); 3.479 ++ flags = __gmpfr_flags; 3.480 ++ MPFR_ASSERTN (mpfr_check (z)); 3.481 ++ ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; 3.482 ++ if (flags != ex_flags) 3.483 ++ { 3.484 ++ printf ("Bad flags in test_extreme on z = a/b" 3.485 ++ " with %s and\n", 3.486 ++ mpfr_print_rnd_mode ((mpfr_rnd_t) r)); 3.487 ++ printf ("a = "); 3.488 ++ mpfr_dump (y); 3.489 ++ printf ("b = "); 3.490 ++ mpfr_dump (x); 3.491 ++ printf ("Expected flags:"); 3.492 ++ flags_out (ex_flags); 3.493 ++ printf ("Got flags: "); 3.494 ++ flags_out (flags); 3.495 ++ printf ("z = "); 3.496 ++ mpfr_dump (z); 3.497 ++ exit (1); 3.498 ++ } 3.499 ++ } 3.500 ++ mpfr_clear (z); 3.501 ++ } /* zi */ 3.502 ++ mpfr_nextabove (y); 3.503 ++ } /* j */ 3.504 ++ mpfr_clear (y); 3.505 ++ } /* yi */ 3.506 ++ mpfr_clear (x); 3.507 ++ } /* xi */ 3.508 ++ 3.509 ++ set_emin (emin); 3.510 ++ set_emax (emax); 3.511 ++} 3.512 ++ 3.513 + int 3.514 + main (int argc, char *argv[]) 3.515 + { 3.516 +@@ -1130,6 +1220,7 @@ 3.517 + test_20070603 (); 3.518 + test_20070628 (); 3.519 + test_generic (2, 800, 50); 3.520 ++ test_extreme (); 3.521 + 3.522 + tests_end_mpfr (); 3.523 + return 0; 3.524 +--- a/tests/texp.c 2013-03-13 16:37:44.000000000 +0100 3.525 ++++ b/tests/texp.c 2014-12-31 14:56:02.689642010 +0100 3.526 +@@ -150,6 +150,22 @@ 3.527 + exit (1); 3.528 + } 3.529 + 3.530 ++ mpfr_set_prec (x, 118); 3.531 ++ mpfr_set_str_binary (x, "0.1110010100011101010000111110011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E-86"); 3.532 ++ mpfr_set_prec (y, 118); 3.533 ++ mpfr_exp_2 (y, x, MPFR_RNDU); 3.534 ++ mpfr_exp_3 (x, x, MPFR_RNDU); 3.535 ++ if (mpfr_cmp (x, y)) 3.536 ++ { 3.537 ++ printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=118\n"); 3.538 ++ printf ("mpfr_exp_2 gives "); 3.539 ++ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); 3.540 ++ printf ("\nmpfr_exp_3 gives "); 3.541 ++ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); 3.542 ++ printf ("\n"); 3.543 ++ exit (1); 3.544 ++ } 3.545 ++ 3.546 + mpfr_clear (x); 3.547 + mpfr_clear (y); 3.548 + return 0; 3.549 +--- a/tests/tfits.c 2013-03-13 16:37:45.000000000 +0100 3.550 ++++ b/tests/tfits.c 2014-12-31 14:56:02.689642010 +0100 3.551 +@@ -33,155 +33,176 @@ 3.552 + #include "mpfr-intmax.h" 3.553 + #include "mpfr-test.h" 3.554 + 3.555 +-#define ERROR1 { printf("Initial error for x="); mpfr_dump(x); exit(1); } 3.556 +-#define ERROR2 { printf("Error for x="); mpfr_dump(x); exit(1); } 3.557 ++#define ERROR1(N) \ 3.558 ++ do \ 3.559 ++ { \ 3.560 ++ printf("Error %d for rnd = %s and x = ", N, \ 3.561 ++ mpfr_print_rnd_mode ((mpfr_rnd_t) r)); \ 3.562 ++ mpfr_dump(x); \ 3.563 ++ exit(1); \ 3.564 ++ } \ 3.565 ++ while (0) 3.566 + 3.567 + static void check_intmax (void); 3.568 + 3.569 + int 3.570 + main (void) 3.571 + { 3.572 +- mpfr_t x; 3.573 ++ mpfr_t x, y; 3.574 ++ int i, r; 3.575 + 3.576 + tests_start_mpfr (); 3.577 + 3.578 + mpfr_init2 (x, 256); 3.579 ++ mpfr_init2 (y, 8); 3.580 + 3.581 +- /* Check NAN */ 3.582 +- mpfr_set_nan (x); 3.583 +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.584 +- ERROR1; 3.585 +- if (mpfr_fits_slong_p (x, MPFR_RNDN)) 3.586 +- ERROR1; 3.587 +- if (mpfr_fits_uint_p (x, MPFR_RNDN)) 3.588 +- ERROR1; 3.589 +- if (mpfr_fits_sint_p (x, MPFR_RNDN)) 3.590 +- ERROR1; 3.591 +- if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 3.592 +- ERROR1; 3.593 +- if (mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.594 +- ERROR1; 3.595 +- 3.596 +- /* Check INF */ 3.597 +- mpfr_set_inf (x, 1); 3.598 +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.599 +- ERROR1; 3.600 +- if (mpfr_fits_slong_p (x, MPFR_RNDN)) 3.601 +- ERROR1; 3.602 +- if (mpfr_fits_uint_p (x, MPFR_RNDN)) 3.603 +- ERROR1; 3.604 +- if (mpfr_fits_sint_p (x, MPFR_RNDN)) 3.605 +- ERROR1; 3.606 +- if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 3.607 +- ERROR1; 3.608 +- if (mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.609 +- ERROR1; 3.610 +- 3.611 +- /* Check Zero */ 3.612 +- MPFR_SET_ZERO (x); 3.613 +- if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.614 +- ERROR2; 3.615 +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 3.616 +- ERROR2; 3.617 +- if (!mpfr_fits_uint_p (x, MPFR_RNDN)) 3.618 +- ERROR2; 3.619 +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 3.620 +- ERROR2; 3.621 +- if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) 3.622 +- ERROR2; 3.623 +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.624 +- ERROR2; 3.625 +- 3.626 +- /* Check small op */ 3.627 +- mpfr_set_str1 (x, "1@-1"); 3.628 +- if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.629 +- ERROR2; 3.630 +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 3.631 +- ERROR2; 3.632 +- if (!mpfr_fits_uint_p (x, MPFR_RNDN)) 3.633 +- ERROR2; 3.634 +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 3.635 +- ERROR2; 3.636 +- if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) 3.637 +- ERROR2; 3.638 +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.639 +- ERROR2; 3.640 +- 3.641 +- /* Check 17 */ 3.642 +- mpfr_set_ui (x, 17, MPFR_RNDN); 3.643 +- if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.644 +- ERROR2; 3.645 +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 3.646 +- ERROR2; 3.647 +- if (!mpfr_fits_uint_p (x, MPFR_RNDN)) 3.648 +- ERROR2; 3.649 +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 3.650 +- ERROR2; 3.651 +- if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) 3.652 +- ERROR2; 3.653 +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.654 +- ERROR2; 3.655 +- 3.656 +- /* Check all other values */ 3.657 +- mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 3.658 +- mpfr_mul_2exp (x, x, 1, MPFR_RNDN); 3.659 +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.660 +- ERROR1; 3.661 +- if (mpfr_fits_slong_p (x, MPFR_RNDN)) 3.662 +- ERROR1; 3.663 +- mpfr_mul_2exp (x, x, 40, MPFR_RNDN); 3.664 +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.665 +- ERROR1; 3.666 +- if (mpfr_fits_uint_p (x, MPFR_RNDN)) 3.667 +- ERROR1; 3.668 +- if (mpfr_fits_sint_p (x, MPFR_RNDN)) 3.669 +- ERROR1; 3.670 +- if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 3.671 +- ERROR1; 3.672 +- if (mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.673 +- ERROR1; 3.674 +- 3.675 +- mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 3.676 +- if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.677 +- ERROR2; 3.678 +- mpfr_set_ui (x, LONG_MAX, MPFR_RNDN); 3.679 +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 3.680 +- ERROR2; 3.681 +- mpfr_set_ui (x, UINT_MAX, MPFR_RNDN); 3.682 +- if (!mpfr_fits_uint_p (x, MPFR_RNDN)) 3.683 +- ERROR2; 3.684 +- mpfr_set_ui (x, INT_MAX, MPFR_RNDN); 3.685 +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 3.686 +- ERROR2; 3.687 +- mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN); 3.688 +- if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) 3.689 +- ERROR2; 3.690 +- mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN); 3.691 +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.692 +- ERROR2; 3.693 +- 3.694 +- mpfr_set_si (x, 1, MPFR_RNDN); 3.695 +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 3.696 +- ERROR2; 3.697 +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.698 +- ERROR2; 3.699 +- 3.700 +- /* Check negative value */ 3.701 +- mpfr_set_si (x, -1, MPFR_RNDN); 3.702 +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 3.703 +- ERROR2; 3.704 +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 3.705 +- ERROR2; 3.706 +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 3.707 +- ERROR2; 3.708 +- if (mpfr_fits_uint_p (x, MPFR_RNDN)) 3.709 +- ERROR1; 3.710 +- if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 3.711 +- ERROR1; 3.712 +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 3.713 +- ERROR1; 3.714 ++ RND_LOOP (r) 3.715 ++ { 3.716 ++ 3.717 ++ /* Check NAN */ 3.718 ++ mpfr_set_nan (x); 3.719 ++ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 3.720 ++ ERROR1 (1); 3.721 ++ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 3.722 ++ ERROR1 (2); 3.723 ++ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 3.724 ++ ERROR1 (3); 3.725 ++ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.726 ++ ERROR1 (4); 3.727 ++ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 3.728 ++ ERROR1 (5); 3.729 ++ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.730 ++ ERROR1 (6); 3.731 ++ 3.732 ++ /* Check INF */ 3.733 ++ mpfr_set_inf (x, 1); 3.734 ++ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 3.735 ++ ERROR1 (7); 3.736 ++ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 3.737 ++ ERROR1 (8); 3.738 ++ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 3.739 ++ ERROR1 (9); 3.740 ++ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.741 ++ ERROR1 (10); 3.742 ++ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 3.743 ++ ERROR1 (11); 3.744 ++ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.745 ++ ERROR1 (12); 3.746 ++ 3.747 ++ /* Check Zero */ 3.748 ++ MPFR_SET_ZERO (x); 3.749 ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 3.750 ++ ERROR1 (13); 3.751 ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 3.752 ++ ERROR1 (14); 3.753 ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 3.754 ++ ERROR1 (15); 3.755 ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.756 ++ ERROR1 (16); 3.757 ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 3.758 ++ ERROR1 (17); 3.759 ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.760 ++ ERROR1 (18); 3.761 ++ 3.762 ++ /* Check small positive op */ 3.763 ++ mpfr_set_str1 (x, "1@-1"); 3.764 ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 3.765 ++ ERROR1 (19); 3.766 ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 3.767 ++ ERROR1 (20); 3.768 ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 3.769 ++ ERROR1 (21); 3.770 ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.771 ++ ERROR1 (22); 3.772 ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 3.773 ++ ERROR1 (23); 3.774 ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.775 ++ ERROR1 (24); 3.776 ++ 3.777 ++ /* Check 17 */ 3.778 ++ mpfr_set_ui (x, 17, MPFR_RNDN); 3.779 ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 3.780 ++ ERROR1 (25); 3.781 ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 3.782 ++ ERROR1 (26); 3.783 ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 3.784 ++ ERROR1 (27); 3.785 ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.786 ++ ERROR1 (28); 3.787 ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 3.788 ++ ERROR1 (29); 3.789 ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.790 ++ ERROR1 (30); 3.791 ++ 3.792 ++ /* Check all other values */ 3.793 ++ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 3.794 ++ mpfr_mul_2exp (x, x, 1, MPFR_RNDN); 3.795 ++ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 3.796 ++ ERROR1 (31); 3.797 ++ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 3.798 ++ ERROR1 (32); 3.799 ++ mpfr_mul_2exp (x, x, 40, MPFR_RNDN); 3.800 ++ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 3.801 ++ ERROR1 (33); 3.802 ++ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 3.803 ++ ERROR1 (34); 3.804 ++ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.805 ++ ERROR1 (35); 3.806 ++ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 3.807 ++ ERROR1 (36); 3.808 ++ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.809 ++ ERROR1 (37); 3.810 ++ 3.811 ++ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 3.812 ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 3.813 ++ ERROR1 (38); 3.814 ++ mpfr_set_ui (x, LONG_MAX, MPFR_RNDN); 3.815 ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 3.816 ++ ERROR1 (39); 3.817 ++ mpfr_set_ui (x, UINT_MAX, MPFR_RNDN); 3.818 ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 3.819 ++ ERROR1 (40); 3.820 ++ mpfr_set_ui (x, INT_MAX, MPFR_RNDN); 3.821 ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.822 ++ ERROR1 (41); 3.823 ++ mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN); 3.824 ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 3.825 ++ ERROR1 (42); 3.826 ++ mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN); 3.827 ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.828 ++ ERROR1 (43); 3.829 ++ 3.830 ++ mpfr_set_si (x, 1, MPFR_RNDN); 3.831 ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.832 ++ ERROR1 (44); 3.833 ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.834 ++ ERROR1 (45); 3.835 ++ 3.836 ++ /* Check negative op */ 3.837 ++ for (i = 1; i <= 4; i++) 3.838 ++ { 3.839 ++ int inv; 3.840 ++ 3.841 ++ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); 3.842 ++ mpfr_rint (y, x, (mpfr_rnd_t) r); 3.843 ++ inv = MPFR_NOTZERO (y); 3.844 ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r) ^ inv) 3.845 ++ ERROR1 (46); 3.846 ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 3.847 ++ ERROR1 (47); 3.848 ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r) ^ inv) 3.849 ++ ERROR1 (48); 3.850 ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 3.851 ++ ERROR1 (49); 3.852 ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r) ^ inv) 3.853 ++ ERROR1 (50); 3.854 ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 3.855 ++ ERROR1 (51); 3.856 ++ } 3.857 ++ } 3.858 + 3.859 + mpfr_clear (x); 3.860 ++ mpfr_clear (y); 3.861 + 3.862 + check_intmax (); 3.863 + 3.864 +@@ -189,85 +210,98 @@ 3.865 + return 0; 3.866 + } 3.867 + 3.868 +-static void check_intmax (void) 3.869 ++static void 3.870 ++check_intmax (void) 3.871 + { 3.872 + #ifdef _MPFR_H_HAVE_INTMAX_T 3.873 +- mpfr_t x; 3.874 ++ mpfr_t x, y; 3.875 ++ int i, r; 3.876 + 3.877 +- mpfr_init2 (x, sizeof (uintmax_t)*CHAR_BIT); 3.878 ++ mpfr_init2 (x, sizeof (uintmax_t) * CHAR_BIT); 3.879 ++ mpfr_init2 (y, 8); 3.880 + 3.881 +- /* Check NAN */ 3.882 +- mpfr_set_nan (x); 3.883 +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.884 +- ERROR1; 3.885 +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.886 +- ERROR1; 3.887 +- 3.888 +- /* Check INF */ 3.889 +- mpfr_set_inf (x, 1); 3.890 +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.891 +- ERROR1; 3.892 +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.893 +- ERROR1; 3.894 +- 3.895 +- /* Check Zero */ 3.896 +- MPFR_SET_ZERO (x); 3.897 +- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.898 +- ERROR2; 3.899 +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.900 +- ERROR2; 3.901 +- 3.902 +- /* Check small op */ 3.903 +- mpfr_set_str1 (x, "1@-1"); 3.904 +- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.905 +- ERROR2; 3.906 +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.907 +- ERROR2; 3.908 +- 3.909 +- /* Check 17 */ 3.910 +- mpfr_set_ui (x, 17, MPFR_RNDN); 3.911 +- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.912 +- ERROR2; 3.913 +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.914 +- ERROR2; 3.915 +- 3.916 +- /* Check hugest */ 3.917 +- mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); 3.918 +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.919 +- ERROR1; 3.920 +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.921 +- ERROR1; 3.922 +- 3.923 +- /* Check all other values */ 3.924 +- mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); 3.925 +- mpfr_add_ui (x, x, 1, MPFR_RNDN); 3.926 +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.927 +- ERROR1; 3.928 +- mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); 3.929 +- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.930 +- ERROR2; 3.931 +- mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); 3.932 +- mpfr_add_ui (x, x, 1, MPFR_RNDN); 3.933 +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.934 +- ERROR1; 3.935 +- mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); 3.936 +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.937 +- ERROR2; 3.938 +- mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); 3.939 +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.940 +- ERROR2; 3.941 +- mpfr_sub_ui (x, x, 1, MPFR_RNDN); 3.942 +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.943 +- ERROR1; 3.944 +- 3.945 +- /* Check negative value */ 3.946 +- mpfr_set_si (x, -1, MPFR_RNDN); 3.947 +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 3.948 +- ERROR2; 3.949 +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 3.950 +- ERROR1; 3.951 ++ RND_LOOP (r) 3.952 ++ { 3.953 ++ /* Check NAN */ 3.954 ++ mpfr_set_nan (x); 3.955 ++ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 3.956 ++ ERROR1 (52); 3.957 ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.958 ++ ERROR1 (53); 3.959 ++ 3.960 ++ /* Check INF */ 3.961 ++ mpfr_set_inf (x, 1); 3.962 ++ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 3.963 ++ ERROR1 (54); 3.964 ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.965 ++ ERROR1 (55); 3.966 ++ 3.967 ++ /* Check Zero */ 3.968 ++ MPFR_SET_ZERO (x); 3.969 ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 3.970 ++ ERROR1 (56); 3.971 ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.972 ++ ERROR1 (57); 3.973 ++ 3.974 ++ /* Check positive small op */ 3.975 ++ mpfr_set_str1 (x, "1@-1"); 3.976 ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 3.977 ++ ERROR1 (58); 3.978 ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.979 ++ ERROR1 (59); 3.980 ++ 3.981 ++ /* Check 17 */ 3.982 ++ mpfr_set_ui (x, 17, MPFR_RNDN); 3.983 ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 3.984 ++ ERROR1 (60); 3.985 ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.986 ++ ERROR1 (61); 3.987 ++ 3.988 ++ /* Check hugest */ 3.989 ++ mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); 3.990 ++ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 3.991 ++ ERROR1 (62); 3.992 ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.993 ++ ERROR1 (63); 3.994 ++ 3.995 ++ /* Check all other values */ 3.996 ++ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); 3.997 ++ mpfr_add_ui (x, x, 1, MPFR_RNDN); 3.998 ++ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 3.999 ++ ERROR1 (64); 3.1000 ++ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); 3.1001 ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 3.1002 ++ ERROR1 (65); 3.1003 ++ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); 3.1004 ++ mpfr_add_ui (x, x, 1, MPFR_RNDN); 3.1005 ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.1006 ++ ERROR1 (66); 3.1007 ++ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); 3.1008 ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.1009 ++ ERROR1 (67); 3.1010 ++ mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); 3.1011 ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.1012 ++ ERROR1 (68); 3.1013 ++ mpfr_sub_ui (x, x, 1, MPFR_RNDN); 3.1014 ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.1015 ++ ERROR1 (69); 3.1016 ++ 3.1017 ++ /* Check negative op */ 3.1018 ++ for (i = 1; i <= 4; i++) 3.1019 ++ { 3.1020 ++ int inv; 3.1021 ++ 3.1022 ++ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); 3.1023 ++ mpfr_rint (y, x, (mpfr_rnd_t) r); 3.1024 ++ inv = MPFR_NOTZERO (y); 3.1025 ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r) ^ inv) 3.1026 ++ ERROR1 (70); 3.1027 ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 3.1028 ++ ERROR1 (71); 3.1029 ++ } 3.1030 ++ } 3.1031 + 3.1032 + mpfr_clear (x); 3.1033 ++ mpfr_clear (y); 3.1034 + #endif 3.1035 + } 3.1036 +- 3.1037 +--- a/tests/tget_flt.c 2013-03-13 16:37:44.000000000 +0100 3.1038 ++++ b/tests/tget_flt.c 2014-12-31 14:56:02.690642023 +0100 3.1039 +@@ -28,9 +28,17 @@ 3.1040 + main (void) 3.1041 + { 3.1042 + mpfr_t x, y; 3.1043 +- float f, g, infp; 3.1044 ++ float f, g; 3.1045 + int i; 3.1046 ++#if !defined(MPFR_ERRDIVZERO) 3.1047 ++ float infp; 3.1048 ++#endif 3.1049 + 3.1050 ++ tests_start_mpfr (); 3.1051 ++ 3.1052 ++#if !defined(MPFR_ERRDIVZERO) 3.1053 ++ /* The definition of DBL_POS_INF involves a division by 0. This makes 3.1054 ++ "clang -O2 -fsanitize=undefined -fno-sanitize-recover" fail. */ 3.1055 + infp = (float) DBL_POS_INF; 3.1056 + if (infp * 0.5 != infp) 3.1057 + { 3.1058 +@@ -38,8 +46,7 @@ 3.1059 + fprintf (stderr, "(this is probably a compiler bug, please report)\n"); 3.1060 + exit (1); 3.1061 + } 3.1062 +- 3.1063 +- tests_start_mpfr (); 3.1064 ++#endif 3.1065 + 3.1066 + mpfr_init2 (x, 24); 3.1067 + mpfr_init2 (y, 24); 3.1068 +@@ -353,6 +360,7 @@ 3.1069 + printf ("expected %.8e, got %.8e\n", g, f); 3.1070 + exit (1); 3.1071 + } 3.1072 ++#if !defined(MPFR_ERRDIVZERO) 3.1073 + f = mpfr_get_flt (x, MPFR_RNDN); /* first round to 2^128 (even rule), 3.1074 + thus we should get +Inf */ 3.1075 + g = infp; 3.1076 +@@ -376,6 +384,7 @@ 3.1077 + printf ("expected %.8e, got %.8e\n", g, f); 3.1078 + exit (1); 3.1079 + } 3.1080 ++#endif 3.1081 + 3.1082 + mpfr_clear (x); 3.1083 + mpfr_clear (y); 3.1084 +--- a/tests/tset_ld.c 2013-03-13 16:37:44.000000000 +0100 3.1085 ++++ b/tests/tset_ld.c 2014-12-31 14:56:02.690642023 +0100 3.1086 +@@ -47,8 +47,11 @@ 3.1087 + static int 3.1088 + Isnan_ld (long double d) 3.1089 + { 3.1090 +- double e = (double) d; 3.1091 +- if (DOUBLE_ISNAN (e)) 3.1092 ++ /* Do not convert d to double as this can give an overflow, which 3.1093 ++ may confuse compilers without IEEE 754 support (such as clang 3.1094 ++ -fsanitize=undefined), or trigger a trap if enabled. 3.1095 ++ The DOUBLE_ISNAN macro should work fine on long double. */ 3.1096 ++ if (DOUBLE_ISNAN (d)) 3.1097 + return 1; 3.1098 + LONGDOUBLE_NAN_ACTION (d, goto yes); 3.1099 + return 0; 3.1100 +--- a/tests/tsprintf.c 2013-03-13 16:37:44.000000000 +0100 3.1101 ++++ b/tests/tsprintf.c 2014-12-31 14:56:02.690642023 +0100 3.1102 +@@ -456,10 +456,16 @@ 3.1103 + check_sprintf ("1.999900 ", "%-#10.7RG", x); 3.1104 + check_sprintf ("1.9999 ", "%-10.7RG", x); 3.1105 + mpfr_set_ui (x, 1, MPFR_RNDN); 3.1106 ++ check_sprintf ("1.", "%#.1Rg", x); 3.1107 ++ check_sprintf ("1. ", "%-#5.1Rg", x); 3.1108 ++ check_sprintf (" 1.0", "%#5.2Rg", x); 3.1109 + check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x); 3.1110 + check_sprintf ("1", "%.30Rg", x); 3.1111 + mpfr_set_ui (x, 0, MPFR_RNDN); 3.1112 +- check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x); 3.1113 ++ check_sprintf ("0.", "%#.1Rg", x); 3.1114 ++ check_sprintf ("0. ", "%-#5.1Rg", x); 3.1115 ++ check_sprintf (" 0.0", "%#5.2Rg", x); 3.1116 ++ check_sprintf ("0.00000000000000000000000000000", "%#.30Rg", x); 3.1117 + check_sprintf ("0", "%.30Rg", x); 3.1118 + 3.1119 + /* following tests with precision 53 bits */ 3.1120 +@@ -1178,6 +1184,69 @@ 3.1121 + check_emax_aux (MPFR_EMAX_MAX); 3.1122 + } 3.1123 + 3.1124 ++static void 3.1125 ++check_emin_aux (mpfr_exp_t e) 3.1126 ++{ 3.1127 ++ mpfr_t x; 3.1128 ++ char *s1, s2[256]; 3.1129 ++ int i; 3.1130 ++ mpfr_exp_t emin; 3.1131 ++ mpz_t ee; 3.1132 ++ 3.1133 ++ MPFR_ASSERTN (e >= LONG_MIN); 3.1134 ++ emin = mpfr_get_emin (); 3.1135 ++ set_emin (e); 3.1136 ++ 3.1137 ++ mpfr_init2 (x, 16); 3.1138 ++ mpz_init (ee); 3.1139 ++ 3.1140 ++ mpfr_setmin (x, e); 3.1141 ++ mpz_set_si (ee, e); 3.1142 ++ mpz_sub_ui (ee, ee, 1); 3.1143 ++ 3.1144 ++ i = mpfr_asprintf (&s1, "%Ra", x); 3.1145 ++ MPFR_ASSERTN (i > 0); 3.1146 ++ 3.1147 ++ gmp_snprintf (s2, 256, "0x1p%Zd", ee); 3.1148 ++ 3.1149 ++ if (strcmp (s1, s2) != 0) 3.1150 ++ { 3.1151 ++ printf ("Error in check_emin_aux for emin = %ld\n", (long) e); 3.1152 ++ printf ("Expected %s\n", s2); 3.1153 ++ printf ("Got %s\n", s1); 3.1154 ++ exit (1); 3.1155 ++ } 3.1156 ++ 3.1157 ++ mpfr_free_str (s1); 3.1158 ++ 3.1159 ++ i = mpfr_asprintf (&s1, "%Rb", x); 3.1160 ++ MPFR_ASSERTN (i > 0); 3.1161 ++ 3.1162 ++ gmp_snprintf (s2, 256, "1p%Zd", ee); 3.1163 ++ 3.1164 ++ if (strcmp (s1, s2) != 0) 3.1165 ++ { 3.1166 ++ printf ("Error in check_emin_aux for emin = %ld\n", (long) e); 3.1167 ++ printf ("Expected %s\n", s2); 3.1168 ++ printf ("Got %s\n", s1); 3.1169 ++ exit (1); 3.1170 ++ } 3.1171 ++ 3.1172 ++ mpfr_free_str (s1); 3.1173 ++ 3.1174 ++ mpfr_clear (x); 3.1175 ++ mpz_clear (ee); 3.1176 ++ set_emin (emin); 3.1177 ++} 3.1178 ++ 3.1179 ++static void 3.1180 ++check_emin (void) 3.1181 ++{ 3.1182 ++ check_emin_aux (-15); 3.1183 ++ check_emin_aux (mpfr_get_emin ()); 3.1184 ++ check_emin_aux (MPFR_EMIN_MIN); 3.1185 ++} 3.1186 ++ 3.1187 + int 3.1188 + main (int argc, char **argv) 3.1189 + { 3.1190 +@@ -1197,6 +1266,7 @@ 3.1191 + decimal (); 3.1192 + mixed (); 3.1193 + check_emax (); 3.1194 ++ check_emin (); 3.1195 + 3.1196 + #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) 3.1197 + locale_da_DK (); 3.1198 +--- a/VERSION 2013-03-13 16:37:28.000000000 +0100 3.1199 ++++ b/VERSION 2014-12-31 14:56:02.690642023 +0100 3.1200 +@@ -1 +1 @@ 3.1201 +-3.1.2 3.1202 ++3.1.2-p11