Changeset c8b646b
- Timestamp:
- Mar 10, 2014, 7:24:30 PM (11 years ago)
- Branches:
- clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
- Children:
- b2bbca4
- Parents:
- 9d71b20
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
patches/mpfr-3.1.2-fixes-2.patch
r9d71b20 rc8b646b 1 1 Submitted By: William Harrington (kb0iic at cross-lfs dot org) 2 Date: 201 3-11-112 Date: 2014-03-10 3 3 Initial Package Version: 3.1.2 4 4 Origin: Upstream 5 5 Upstream Status: Applied 6 Description: Contains all upstream patches of mpfr current .6 Description: Contains all upstream patches of mpfr current to patch level 5. 7 7 8 diff -Naur mpfr-3.1.2.orig/PATCHES mpfr-3.1.2/PATCHES 9 --- mpfr-3.1.2.orig/PATCHES 2013-03-13 15:37:38.000000000 +0000 10 +++ mpfr-3.1.2/PATCHES 2013-11-11 23:55:16.818732551 +0000 11 @@ -0,0 +1,3 @@ 12 +clang-divby0 13 +fits-smallneg 8 diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES 9 --- mpfr-3.1.2-a/PATCHES 2013-09-26 10:52:52.000000000 +0000 10 +++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:52:52.000000000 +0000 11 @@ -0,0 +1 @@ 14 12 +exp_2 15 diff -Naur mpfr-3.1.2.orig/VERSION mpfr-3.1.2/VERSION16 --- mpfr-3.1.2 .orig/VERSION 2013-03-13 15:37:28.000000000 +000017 +++ mpfr-3.1.2 /VERSION 2013-11-11 23:55:16.818732551+000013 diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION 14 --- mpfr-3.1.2-a/VERSION 2013-03-13 15:37:28.000000000 +0000 15 +++ mpfr-3.1.2-b/VERSION 2013-09-26 10:52:52.000000000 +0000 18 16 @@ -1 +1 @@ 19 17 -3.1.2 20 +3.1.2-p 321 diff -Naur mpfr-3.1.2.orig/src/exp_2.c mpfr-3.1.2/src/exp_2.c22 --- mpfr-3.1.2 .orig/src/exp_2.c 2013-03-13 15:37:28.000000000 +000023 +++ mpfr-3.1.2 /src/exp_2.c 2013-11-11 23:55:16.810732551+000018 +3.1.2-p1 19 diff -Naurd mpfr-3.1.2-a/src/exp_2.c mpfr-3.1.2-b/src/exp_2.c 20 --- mpfr-3.1.2-a/src/exp_2.c 2013-03-13 15:37:28.000000000 +0000 21 +++ mpfr-3.1.2-b/src/exp_2.c 2013-09-26 10:52:52.000000000 +0000 24 22 @@ -204,7 +204,7 @@ 25 23 for (k = 0; k < K; k++) … … 31 29 } 32 30 mpfr_set_z (s, ss, MPFR_RNDN); 33 diff -Naur mpfr-3.1.2.orig/src/fits_u.h mpfr-3.1.2/src/fits_u.h 34 --- mpfr-3.1.2.orig/src/fits_u.h 2013-03-13 15:37:35.000000000 +0000 35 +++ mpfr-3.1.2/src/fits_u.h 2013-11-11 23:55:16.818732551 +0000 31 diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h 32 --- mpfr-3.1.2-a/src/mpfr.h 2013-03-13 15:37:37.000000000 +0000 33 +++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 34 @@ -27,7 +27,7 @@ 35 #define MPFR_VERSION_MAJOR 3 36 #define MPFR_VERSION_MINOR 1 37 #define MPFR_VERSION_PATCHLEVEL 2 38 -#define MPFR_VERSION_STRING "3.1.2" 39 +#define MPFR_VERSION_STRING "3.1.2-p1" 40 41 /* Macros dealing with MPFR VERSION */ 42 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 43 diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c 44 --- mpfr-3.1.2-a/src/version.c 2013-03-13 15:37:34.000000000 +0000 45 +++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:52:52.000000000 +0000 46 @@ -25,5 +25,5 @@ 47 const char * 48 mpfr_get_version (void) 49 { 50 - return "3.1.2"; 51 + return "3.1.2-p1"; 52 } 53 diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES 54 --- mpfr-3.1.2-a/PATCHES 2013-09-26 10:56:55.000000000 +0000 55 +++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:56:55.000000000 +0000 56 @@ -0,0 +1 @@ 57 +fits-smallneg 58 diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION 59 --- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000 60 +++ mpfr-3.1.2-b/VERSION 2013-09-26 10:56:55.000000000 +0000 61 @@ -1 +1 @@ 62 -3.1.2-p1 63 +3.1.2-p2 64 diff -Naurd mpfr-3.1.2-a/src/fits_u.h mpfr-3.1.2-b/src/fits_u.h 65 --- mpfr-3.1.2-a/src/fits_u.h 2013-03-13 15:37:35.000000000 +0000 66 +++ mpfr-3.1.2-b/src/fits_u.h 2013-09-26 10:56:55.000000000 +0000 36 67 @@ -32,17 +32,20 @@ 37 68 int res; … … 63 94 for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++); 64 95 65 diff -Naur mpfr-3.1.2.orig/src/fits_uintmax.c mpfr-3.1.2/src/fits_uintmax.c66 --- mpfr-3.1.2 .orig/src/fits_uintmax.c 2013-03-13 15:37:33.000000000 +000067 +++ mpfr-3.1.2 /src/fits_uintmax.c 2013-11-11 23:55:16.818732551+000096 diff -Naurd mpfr-3.1.2-a/src/fits_uintmax.c mpfr-3.1.2-b/src/fits_uintmax.c 97 --- mpfr-3.1.2-a/src/fits_uintmax.c 2013-03-13 15:37:33.000000000 +0000 98 +++ mpfr-3.1.2-b/src/fits_uintmax.c 2013-09-26 10:56:55.000000000 +0000 68 99 @@ -27,51 +27,19 @@ 69 100 #include "mpfr-intmax.h" … … 93 124 - 94 125 - e = MPFR_GET_EXP (f); 95 +/* Note: though mpfr-impl.h is included in fits_u.h, we also include it 96 + above so that it gets included even when _MPFR_H_HAVE_INTMAX_T is not 97 + defined; this is necessary to avoid an empty translation unit, which 98 + is forbidden by ISO C. Without this, a failing test can be reproduced 99 + by creating an invalid stdint.h somewhere in the default include path 100 + and by compiling MPFR with "gcc -ansi -pedantic-errors". */ 101 126 - 102 127 - /* first compute prec(MAXIMUM); fits in an int */ 103 128 - for (s = MPFR_UINTMAX_MAX, prec = 0; s != 0; s /= 2, prec ++); … … 108 133 - if (e <= prec - 1) 109 134 - return 1; 110 - 135 +/* Note: though mpfr-impl.h is included in fits_u.h, we also include it 136 + above so that it gets included even when _MPFR_H_HAVE_INTMAX_T is not 137 + defined; this is necessary to avoid an empty translation unit, which 138 + is forbidden by ISO C. Without this, a failing test can be reproduced 139 + by creating an invalid stdint.h somewhere in the default include path 140 + and by compiling MPFR with "gcc -ansi -pedantic-errors". */ 141 111 142 - /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */ 112 143 - if (e >= prec + 1) … … 129 160 130 161 #endif 131 diff -Naur mpfr-3.1.2.orig/src/mpfr-impl.h mpfr-3.1.2/src/mpfr-impl.h 132 --- mpfr-3.1.2.orig/src/mpfr-impl.h 2013-03-13 15:37:36.000000000 +0000 133 +++ mpfr-3.1.2/src/mpfr-impl.h 2013-11-11 23:55:16.818732551 +0000 134 @@ -468,8 +468,16 @@ 135 #define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1) 136 137 /* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0 138 - at compile time. */ 139 -#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200) 140 + at compile time. 141 + Clang with -fsanitize=undefined is a bit similar due to a bug: 142 + http://llvm.org/bugs/show_bug.cgi?id=17381 143 + but even without its sanitizer, it may be better to use the 144 + double_zero version until IEEE 754 division by zero is properly 145 + supported: 146 + http://llvm.org/bugs/show_bug.cgi?id=17000 147 +*/ 148 +#if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \ 149 + defined(__clang__) 150 static double double_zero = 0.0; 151 # define DBL_NAN (double_zero/double_zero) 152 # define DBL_POS_INF ((double) 1.0/double_zero) 153 @@ -501,6 +509,8 @@ 154 (with Xcode 2.4.1, i.e. the latest one). */ 155 #define LVALUE(x) (&(x) == &(x) || &(x) != &(x)) 156 #define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX)) 157 +/* The DOUBLE_ISNAN(x) macro is also valid on long double x 158 + (assuming that the compiler isn't too broken). */ 159 #ifdef MPFR_NANISNAN 160 /* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations. 161 The + must not be replaced by a ||. With gcc -ffast-math, NaN is 162 diff -Naur mpfr-3.1.2.orig/src/mpfr.h mpfr-3.1.2/src/mpfr.h 163 --- mpfr-3.1.2.orig/src/mpfr.h 2013-03-13 15:37:37.000000000 +0000 164 +++ mpfr-3.1.2/src/mpfr.h 2013-11-11 23:55:16.818732551 +0000 162 diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h 163 --- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 164 +++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:56:55.000000000 +0000 165 165 @@ -27,7 +27,7 @@ 166 166 #define MPFR_VERSION_MAJOR 3 167 167 #define MPFR_VERSION_MINOR 1 168 168 #define MPFR_VERSION_PATCHLEVEL 2 169 -#define MPFR_VERSION_STRING "3.1.2 "170 +#define MPFR_VERSION_STRING "3.1.2-p 3"169 -#define MPFR_VERSION_STRING "3.1.2-p1" 170 +#define MPFR_VERSION_STRING "3.1.2-p2" 171 171 172 172 /* Macros dealing with MPFR VERSION */ 173 173 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 174 diff -Naur mpfr-3.1.2.orig/src/version.c mpfr-3.1.2/src/version.c175 --- mpfr-3.1.2 .orig/src/version.c 2013-03-13 15:37:34.000000000 +0000176 +++ mpfr-3.1.2 /src/version.c 2013-11-11 23:55:16.818732551+0000174 diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c 175 --- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000 176 +++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:56:55.000000000 +0000 177 177 @@ -25,5 +25,5 @@ 178 178 const char * 179 179 mpfr_get_version (void) 180 180 { 181 - return "3.1.2 ";182 + return "3.1.2-p 3";181 - return "3.1.2-p1"; 182 + return "3.1.2-p2"; 183 183 } 184 diff -Naur mpfr-3.1.2.orig/tests/tfits.c mpfr-3.1.2/tests/tfits.c185 --- mpfr-3.1.2 .orig/tests/tfits.c 2013-03-13 15:37:45.000000000 +0000186 +++ mpfr-3.1.2 /tests/tfits.c 2013-11-11 23:55:16.818732551+0000184 diff -Naurd mpfr-3.1.2-a/tests/tfits.c mpfr-3.1.2-b/tests/tfits.c 185 --- mpfr-3.1.2-a/tests/tfits.c 2013-03-13 15:37:45.000000000 +0000 186 +++ mpfr-3.1.2-b/tests/tfits.c 2013-09-26 10:56:55.000000000 +0000 187 187 @@ -33,155 +33,176 @@ 188 188 #include "mpfr-intmax.h" … … 229 229 - if (mpfr_fits_sshort_p (x, MPFR_RNDN)) 230 230 - ERROR1; 231 - 231 + RND_LOOP (r) 232 + { 233 232 234 - /* Check INF */ 233 235 - mpfr_set_inf (x, 1); … … 244 246 - if (mpfr_fits_sshort_p (x, MPFR_RNDN)) 245 247 - ERROR1; 246 -247 - /* Check Zero */248 - MPFR_SET_ZERO (x);249 - if (!mpfr_fits_ulong_p (x, MPFR_RNDN))250 - ERROR2;251 - if (!mpfr_fits_slong_p (x, MPFR_RNDN))252 - ERROR2;253 - if (!mpfr_fits_uint_p (x, MPFR_RNDN))254 - ERROR2;255 - if (!mpfr_fits_sint_p (x, MPFR_RNDN))256 - ERROR2;257 - if (!mpfr_fits_ushort_p (x, MPFR_RNDN))258 - ERROR2;259 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN))260 - ERROR2;261 -262 - /* Check small op */263 - mpfr_set_str1 (x, "1@-1");264 - if (!mpfr_fits_ulong_p (x, MPFR_RNDN))265 - ERROR2;266 - if (!mpfr_fits_slong_p (x, MPFR_RNDN))267 - ERROR2;268 - if (!mpfr_fits_uint_p (x, MPFR_RNDN))269 - ERROR2;270 - if (!mpfr_fits_sint_p (x, MPFR_RNDN))271 - ERROR2;272 - if (!mpfr_fits_ushort_p (x, MPFR_RNDN))273 - ERROR2;274 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN))275 - ERROR2;276 -277 - /* Check 17 */278 - mpfr_set_ui (x, 17, MPFR_RNDN);279 - if (!mpfr_fits_ulong_p (x, MPFR_RNDN))280 - ERROR2;281 - if (!mpfr_fits_slong_p (x, MPFR_RNDN))282 - ERROR2;283 - if (!mpfr_fits_uint_p (x, MPFR_RNDN))284 - ERROR2;285 - if (!mpfr_fits_sint_p (x, MPFR_RNDN))286 - ERROR2;287 - if (!mpfr_fits_ushort_p (x, MPFR_RNDN))288 - ERROR2;289 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN))290 - ERROR2;291 -292 - /* Check all other values */293 - mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);294 - mpfr_mul_2exp (x, x, 1, MPFR_RNDN);295 - if (mpfr_fits_ulong_p (x, MPFR_RNDN))296 - ERROR1;297 - if (mpfr_fits_slong_p (x, MPFR_RNDN))298 - ERROR1;299 - mpfr_mul_2exp (x, x, 40, MPFR_RNDN);300 - if (mpfr_fits_ulong_p (x, MPFR_RNDN))301 - ERROR1;302 - if (mpfr_fits_uint_p (x, MPFR_RNDN))303 - ERROR1;304 - if (mpfr_fits_sint_p (x, MPFR_RNDN))305 - ERROR1;306 - if (mpfr_fits_ushort_p (x, MPFR_RNDN))307 - ERROR1;308 - if (mpfr_fits_sshort_p (x, MPFR_RNDN))309 - ERROR1;310 -311 - mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);312 - if (!mpfr_fits_ulong_p (x, MPFR_RNDN))313 - ERROR2;314 - mpfr_set_ui (x, LONG_MAX, MPFR_RNDN);315 - if (!mpfr_fits_slong_p (x, MPFR_RNDN))316 - ERROR2;317 - mpfr_set_ui (x, UINT_MAX, MPFR_RNDN);318 - if (!mpfr_fits_uint_p (x, MPFR_RNDN))319 - ERROR2;320 - mpfr_set_ui (x, INT_MAX, MPFR_RNDN);321 - if (!mpfr_fits_sint_p (x, MPFR_RNDN))322 - ERROR2;323 - mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN);324 - if (!mpfr_fits_ushort_p (x, MPFR_RNDN))325 - ERROR2;326 - mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN);327 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN))328 - ERROR2;329 -330 - mpfr_set_si (x, 1, MPFR_RNDN);331 - if (!mpfr_fits_sint_p (x, MPFR_RNDN))332 - ERROR2;333 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN))334 - ERROR2;335 -336 - /* Check negative value */337 - mpfr_set_si (x, -1, MPFR_RNDN);338 - if (!mpfr_fits_sint_p (x, MPFR_RNDN))339 - ERROR2;340 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN))341 - ERROR2;342 - if (!mpfr_fits_slong_p (x, MPFR_RNDN))343 - ERROR2;344 - if (mpfr_fits_uint_p (x, MPFR_RNDN))345 - ERROR1;346 - if (mpfr_fits_ushort_p (x, MPFR_RNDN))347 - ERROR1;348 - if (mpfr_fits_ulong_p (x, MPFR_RNDN))349 - ERROR1;350 + RND_LOOP (r)351 + {352 +353 248 + /* Check NAN */ 354 249 + mpfr_set_nan (x); … … 365 260 + if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 366 261 + ERROR1 (6); 367 + 262 263 - /* Check Zero */ 264 - MPFR_SET_ZERO (x); 265 - if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) 266 - ERROR2; 267 - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 268 - ERROR2; 269 - if (!mpfr_fits_uint_p (x, MPFR_RNDN)) 270 - ERROR2; 271 - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 272 - ERROR2; 273 - if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) 274 - ERROR2; 275 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 276 - ERROR2; 368 277 + /* Check INF */ 369 278 + mpfr_set_inf (x, 1); … … 380 289 + if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 381 290 + ERROR1 (12); 382 + 291 292 - /* Check small op */ 293 - mpfr_set_str1 (x, "1@-1"); 294 - if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) 295 - ERROR2; 296 - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 297 - ERROR2; 298 - if (!mpfr_fits_uint_p (x, MPFR_RNDN)) 299 - ERROR2; 300 - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 301 - ERROR2; 302 - if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) 303 - ERROR2; 304 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 305 - ERROR2; 383 306 + /* Check Zero */ 384 307 + MPFR_SET_ZERO (x); … … 395 318 + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 396 319 + ERROR1 (18); 397 + 320 321 - /* Check 17 */ 322 - mpfr_set_ui (x, 17, MPFR_RNDN); 323 - if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) 324 - ERROR2; 325 - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 326 - ERROR2; 327 - if (!mpfr_fits_uint_p (x, MPFR_RNDN)) 328 - ERROR2; 329 - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 330 - ERROR2; 331 - if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) 332 - ERROR2; 333 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 334 - ERROR2; 398 335 + /* Check small positive op */ 399 336 + mpfr_set_str1 (x, "1@-1"); … … 410 347 + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 411 348 + ERROR1 (24); 412 + 349 350 - /* Check all other values */ 351 - mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 352 - mpfr_mul_2exp (x, x, 1, MPFR_RNDN); 353 - if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 354 - ERROR1; 355 - if (mpfr_fits_slong_p (x, MPFR_RNDN)) 356 - ERROR1; 357 - mpfr_mul_2exp (x, x, 40, MPFR_RNDN); 358 - if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 359 - ERROR1; 360 - if (mpfr_fits_uint_p (x, MPFR_RNDN)) 361 - ERROR1; 362 - if (mpfr_fits_sint_p (x, MPFR_RNDN)) 363 - ERROR1; 364 - if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 365 - ERROR1; 366 - if (mpfr_fits_sshort_p (x, MPFR_RNDN)) 367 - ERROR1; 413 368 + /* Check 17 */ 414 369 + mpfr_set_ui (x, 17, MPFR_RNDN); … … 425 380 + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 426 381 + ERROR1 (30); 427 + 382 383 - mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 384 - if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) 385 - ERROR2; 386 - mpfr_set_ui (x, LONG_MAX, MPFR_RNDN); 387 - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 388 - ERROR2; 389 - mpfr_set_ui (x, UINT_MAX, MPFR_RNDN); 390 - if (!mpfr_fits_uint_p (x, MPFR_RNDN)) 391 - ERROR2; 392 - mpfr_set_ui (x, INT_MAX, MPFR_RNDN); 393 - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 394 - ERROR2; 395 - mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN); 396 - if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) 397 - ERROR2; 398 - mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN); 399 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 400 - ERROR2; 428 401 + /* Check all other values */ 429 402 + mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); … … 444 417 + if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 445 418 + ERROR1 (37); 446 + 419 420 - mpfr_set_si (x, 1, MPFR_RNDN); 421 - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 422 - ERROR2; 423 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 424 - ERROR2; 447 425 + mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 448 426 + if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) … … 463 441 + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 464 442 + ERROR1 (43); 465 + 443 444 - /* Check negative value */ 445 - mpfr_set_si (x, -1, MPFR_RNDN); 446 - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 447 - ERROR2; 448 - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 449 - ERROR2; 450 - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 451 - ERROR2; 452 - if (mpfr_fits_uint_p (x, MPFR_RNDN)) 453 - ERROR1; 454 - if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 455 - ERROR1; 456 - if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 457 - ERROR1; 466 458 + mpfr_set_si (x, 1, MPFR_RNDN); 467 459 + if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) … … 521 513 - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 522 514 - ERROR1; 523 -524 - /* Check INF */525 - mpfr_set_inf (x, 1);526 - if (mpfr_fits_uintmax_p (x, MPFR_RNDN))527 - ERROR1;528 - if (mpfr_fits_intmax_p (x, MPFR_RNDN))529 - ERROR1;530 -531 - /* Check Zero */532 - MPFR_SET_ZERO (x);533 - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))534 - ERROR2;535 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN))536 - ERROR2;537 -538 - /* Check small op */539 - mpfr_set_str1 (x, "1@-1");540 - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))541 - ERROR2;542 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN))543 - ERROR2;544 -545 - /* Check 17 */546 - mpfr_set_ui (x, 17, MPFR_RNDN);547 - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))548 - ERROR2;549 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN))550 - ERROR2;551 -552 - /* Check hugest */553 - mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN);554 - if (mpfr_fits_uintmax_p (x, MPFR_RNDN))555 - ERROR1;556 - if (mpfr_fits_intmax_p (x, MPFR_RNDN))557 - ERROR1;558 -559 - /* Check all other values */560 - mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);561 - mpfr_add_ui (x, x, 1, MPFR_RNDN);562 - if (mpfr_fits_uintmax_p (x, MPFR_RNDN))563 - ERROR1;564 - mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);565 - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))566 - ERROR2;567 - mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);568 - mpfr_add_ui (x, x, 1, MPFR_RNDN);569 - if (mpfr_fits_intmax_p (x, MPFR_RNDN))570 - ERROR1;571 - mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);572 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN))573 - ERROR2;574 - mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN);575 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN))576 - ERROR2;577 - mpfr_sub_ui (x, x, 1, MPFR_RNDN);578 - if (mpfr_fits_intmax_p (x, MPFR_RNDN))579 - ERROR1;580 -581 - /* Check negative value */582 - mpfr_set_si (x, -1, MPFR_RNDN);583 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN))584 - ERROR2;585 - if (mpfr_fits_uintmax_p (x, MPFR_RNDN))586 - ERROR1;587 515 + RND_LOOP (r) 588 516 + { … … 593 521 + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 594 522 + ERROR1 (53); 595 + 523 524 - /* Check INF */ 525 - mpfr_set_inf (x, 1); 526 - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 527 - ERROR1; 528 - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 529 - ERROR1; 596 530 + /* Check INF */ 597 531 + mpfr_set_inf (x, 1); … … 600 534 + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 601 535 + ERROR1 (55); 602 + 536 537 - /* Check Zero */ 538 - MPFR_SET_ZERO (x); 539 - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) 540 - ERROR2; 541 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 542 - ERROR2; 603 543 + /* Check Zero */ 604 544 + MPFR_SET_ZERO (x); … … 607 547 + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 608 548 + ERROR1 (57); 609 + 549 550 - /* Check small op */ 551 - mpfr_set_str1 (x, "1@-1"); 552 - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) 553 - ERROR2; 554 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 555 - ERROR2; 610 556 + /* Check positive small op */ 611 557 + mpfr_set_str1 (x, "1@-1"); … … 614 560 + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 615 561 + ERROR1 (59); 616 + 562 563 - /* Check 17 */ 564 - mpfr_set_ui (x, 17, MPFR_RNDN); 565 - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) 566 - ERROR2; 567 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 568 - ERROR2; 617 569 + /* Check 17 */ 618 570 + mpfr_set_ui (x, 17, MPFR_RNDN); … … 621 573 + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 622 574 + ERROR1 (61); 623 + 575 576 - /* Check hugest */ 577 - mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); 578 - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 579 - ERROR1; 580 - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 581 - ERROR1; 624 582 + /* Check hugest */ 625 583 + mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); … … 628 586 + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 629 587 + ERROR1 (63); 630 + 588 589 - /* Check all other values */ 590 - mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); 591 - mpfr_add_ui (x, x, 1, MPFR_RNDN); 592 - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 593 - ERROR1; 594 - mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); 595 - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) 596 - ERROR2; 597 - mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); 598 - mpfr_add_ui (x, x, 1, MPFR_RNDN); 599 - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 600 - ERROR1; 601 - mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); 602 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 603 - ERROR2; 604 - mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); 605 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 606 - ERROR2; 607 - mpfr_sub_ui (x, x, 1, MPFR_RNDN); 608 - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 609 - ERROR1; 631 610 + /* Check all other values */ 632 611 + mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); … … 650 629 + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 651 630 + ERROR1 (69); 652 + 631 632 - /* Check negative value */ 633 - mpfr_set_si (x, -1, MPFR_RNDN); 634 - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 635 - ERROR2; 636 - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 637 - ERROR1; 653 638 + /* Check negative op */ 654 639 + for (i = 1; i <= 4; i++) … … 671 656 } 672 657 - 673 diff -Naur mpfr-3.1.2.orig/tests/tget_flt.c mpfr-3.1.2/tests/tget_flt.c 674 --- mpfr-3.1.2.orig/tests/tget_flt.c 2013-03-13 15:37:44.000000000 +0000 675 +++ mpfr-3.1.2/tests/tget_flt.c 2013-11-11 23:55:16.818732551 +0000 658 diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES 659 --- mpfr-3.1.2-a/PATCHES 2013-10-09 13:34:21.000000000 +0000 660 +++ mpfr-3.1.2-b/PATCHES 2013-10-09 13:34:21.000000000 +0000 661 @@ -0,0 +1 @@ 662 +clang-divby0 663 diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION 664 --- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000 665 +++ mpfr-3.1.2-b/VERSION 2013-10-09 13:34:21.000000000 +0000 666 @@ -1 +1 @@ 667 -3.1.2-p2 668 +3.1.2-p3 669 diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h 670 --- mpfr-3.1.2-a/src/mpfr-impl.h 2013-03-13 15:37:36.000000000 +0000 671 +++ mpfr-3.1.2-b/src/mpfr-impl.h 2013-10-09 13:34:21.000000000 +0000 672 @@ -468,8 +468,16 @@ 673 #define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1) 674 675 /* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0 676 - at compile time. */ 677 -#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200) 678 + at compile time. 679 + Clang with -fsanitize=undefined is a bit similar due to a bug: 680 + http://llvm.org/bugs/show_bug.cgi?id=17381 681 + but even without its sanitizer, it may be better to use the 682 + double_zero version until IEEE 754 division by zero is properly 683 + supported: 684 + http://llvm.org/bugs/show_bug.cgi?id=17000 685 +*/ 686 +#if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \ 687 + defined(__clang__) 688 static double double_zero = 0.0; 689 # define DBL_NAN (double_zero/double_zero) 690 # define DBL_POS_INF ((double) 1.0/double_zero) 691 @@ -501,6 +509,8 @@ 692 (with Xcode 2.4.1, i.e. the latest one). */ 693 #define LVALUE(x) (&(x) == &(x) || &(x) != &(x)) 694 #define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX)) 695 +/* The DOUBLE_ISNAN(x) macro is also valid on long double x 696 + (assuming that the compiler isn't too broken). */ 697 #ifdef MPFR_NANISNAN 698 /* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations. 699 The + must not be replaced by a ||. With gcc -ffast-math, NaN is 700 diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h 701 --- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 702 +++ mpfr-3.1.2-b/src/mpfr.h 2013-10-09 13:34:21.000000000 +0000 703 @@ -27,7 +27,7 @@ 704 #define MPFR_VERSION_MAJOR 3 705 #define MPFR_VERSION_MINOR 1 706 #define MPFR_VERSION_PATCHLEVEL 2 707 -#define MPFR_VERSION_STRING "3.1.2-p2" 708 +#define MPFR_VERSION_STRING "3.1.2-p3" 709 710 /* Macros dealing with MPFR VERSION */ 711 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 712 diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c 713 --- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000 714 +++ mpfr-3.1.2-b/src/version.c 2013-10-09 13:34:21.000000000 +0000 715 @@ -25,5 +25,5 @@ 716 const char * 717 mpfr_get_version (void) 718 { 719 - return "3.1.2-p2"; 720 + return "3.1.2-p3"; 721 } 722 diff -Naurd mpfr-3.1.2-a/tests/tget_flt.c mpfr-3.1.2-b/tests/tget_flt.c 723 --- mpfr-3.1.2-a/tests/tget_flt.c 2013-03-13 15:37:44.000000000 +0000 724 +++ mpfr-3.1.2-b/tests/tget_flt.c 2013-10-09 13:34:21.000000000 +0000 676 725 @@ -28,9 +28,17 @@ 677 726 main (void) … … 684 733 + float infp; 685 734 +#endif 686 735 + 687 736 + tests_start_mpfr (); 688 + 737 689 738 +#if !defined(MPFR_ERRDIVZERO) 690 739 + /* The definition of DBL_POS_INF involves a division by 0. This makes … … 719 768 mpfr_clear (x); 720 769 mpfr_clear (y); 721 diff -Naur mpfr-3.1.2.orig/tests/tset_ld.c mpfr-3.1.2/tests/tset_ld.c722 --- mpfr-3.1.2 .orig/tests/tset_ld.c 2013-03-13 15:37:44.000000000 +0000723 +++ mpfr-3.1.2 /tests/tset_ld.c 2013-11-11 23:55:16.818732551+0000770 diff -Naurd mpfr-3.1.2-a/tests/tset_ld.c mpfr-3.1.2-b/tests/tset_ld.c 771 --- mpfr-3.1.2-a/tests/tset_ld.c 2013-03-13 15:37:44.000000000 +0000 772 +++ mpfr-3.1.2-b/tests/tset_ld.c 2013-10-09 13:34:21.000000000 +0000 724 773 @@ -47,8 +47,11 @@ 725 774 static int … … 736 785 LONGDOUBLE_NAN_ACTION (d, goto yes); 737 786 return 0; 787 diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES 788 --- mpfr-3.1.2-a/PATCHES 2013-11-15 00:51:49.211333830 +0000 789 +++ mpfr-3.1.2-b/PATCHES 2013-11-15 00:51:49.323334999 +0000 790 @@ -0,0 +1 @@ 791 +printf-alt0 792 diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION 793 --- mpfr-3.1.2-a/VERSION 2013-11-15 00:51:49.211333830 +0000 794 +++ mpfr-3.1.2-b/VERSION 2013-11-15 00:51:49.323334999 +0000 795 @@ -1 +1 @@ 796 -3.1.2-p3 797 +3.1.2-p4 798 diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h 799 --- mpfr-3.1.2-a/src/mpfr.h 2013-11-15 00:51:49.211333830 +0000 800 +++ mpfr-3.1.2-b/src/mpfr.h 2013-11-15 00:51:49.323334999 +0000 801 @@ -27,7 +27,7 @@ 802 #define MPFR_VERSION_MAJOR 3 803 #define MPFR_VERSION_MINOR 1 804 #define MPFR_VERSION_PATCHLEVEL 2 805 -#define MPFR_VERSION_STRING "3.1.2-p3" 806 +#define MPFR_VERSION_STRING "3.1.2-p4" 807 808 /* Macros dealing with MPFR VERSION */ 809 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 810 diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c 811 --- mpfr-3.1.2-a/src/vasprintf.c 2013-03-13 15:37:37.000000000 +0000 812 +++ mpfr-3.1.2-b/src/vasprintf.c 2013-11-15 00:51:49.267334408 +0000 813 @@ -1040,7 +1040,7 @@ 814 } 815 816 /* Determine the different parts of the string representation of the regular 817 - number P when SPEC.SPEC is 'e', 'E', 'g', or 'G'. 818 + number P when spec.spec is 'e', 'E', 'g', or 'G'. 819 DEC_INFO contains the previously computed exponent and string or is NULL. 820 821 return -1 if some field > INT_MAX */ 822 @@ -1167,7 +1167,7 @@ 823 } 824 825 /* Determine the different parts of the string representation of the regular 826 - number P when SPEC.SPEC is 'f', 'F', 'g', or 'G'. 827 + number P when spec.spec is 'f', 'F', 'g', or 'G'. 828 DEC_INFO contains the previously computed exponent and string or is NULL. 829 830 return -1 if some field of number_parts is greater than INT_MAX */ 831 @@ -1559,7 +1559,7 @@ 832 /* fractional part */ 833 { 834 np->point = MPFR_DECIMAL_POINT; 835 - np->fp_trailing_zeros = (spec.spec == 'g' && spec.spec == 'G') ? 836 + np->fp_trailing_zeros = (spec.spec == 'g' || spec.spec == 'G') ? 837 spec.prec - 1 : spec.prec; 838 } 839 else if (spec.alt) 840 diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c 841 --- mpfr-3.1.2-a/src/version.c 2013-11-15 00:51:49.211333830 +0000 842 +++ mpfr-3.1.2-b/src/version.c 2013-11-15 00:51:49.323334999 +0000 843 @@ -25,5 +25,5 @@ 844 const char * 845 mpfr_get_version (void) 846 { 847 - return "3.1.2-p3"; 848 + return "3.1.2-p4"; 849 } 850 diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c 851 --- mpfr-3.1.2-a/tests/tsprintf.c 2013-03-13 15:37:44.000000000 +0000 852 +++ mpfr-3.1.2-b/tests/tsprintf.c 2013-11-15 00:51:49.267334408 +0000 853 @@ -456,10 +456,16 @@ 854 check_sprintf ("1.999900 ", "%-#10.7RG", x); 855 check_sprintf ("1.9999 ", "%-10.7RG", x); 856 mpfr_set_ui (x, 1, MPFR_RNDN); 857 + check_sprintf ("1.", "%#.1Rg", x); 858 + check_sprintf ("1. ", "%-#5.1Rg", x); 859 + check_sprintf (" 1.0", "%#5.2Rg", x); 860 check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x); 861 check_sprintf ("1", "%.30Rg", x); 862 mpfr_set_ui (x, 0, MPFR_RNDN); 863 - check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x); 864 + check_sprintf ("0.", "%#.1Rg", x); 865 + check_sprintf ("0. ", "%-#5.1Rg", x); 866 + check_sprintf (" 0.0", "%#5.2Rg", x); 867 + check_sprintf ("0.00000000000000000000000000000", "%#.30Rg", x); 868 check_sprintf ("0", "%.30Rg", x); 869 870 /* following tests with precision 53 bits */ 871 diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES 872 --- mpfr-3.1.2-a/PATCHES 2013-12-01 11:07:49.575329762 +0000 873 +++ mpfr-3.1.2-b/PATCHES 2013-12-01 11:07:49.751331625 +0000 874 @@ -0,0 +1 @@ 875 +custom_init_set 876 diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION 877 --- mpfr-3.1.2-a/VERSION 2013-12-01 11:07:49.571329714 +0000 878 +++ mpfr-3.1.2-b/VERSION 2013-12-01 11:07:49.747331585 +0000 879 @@ -1 +1 @@ 880 -3.1.2-p4 881 +3.1.2-p5 882 diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h 883 --- mpfr-3.1.2-a/src/mpfr.h 2013-12-01 11:07:49.571329714 +0000 884 +++ mpfr-3.1.2-b/src/mpfr.h 2013-12-01 11:07:49.747331585 +0000 885 @@ -27,7 +27,7 @@ 886 #define MPFR_VERSION_MAJOR 3 887 #define MPFR_VERSION_MINOR 1 888 #define MPFR_VERSION_PATCHLEVEL 2 889 -#define MPFR_VERSION_STRING "3.1.2-p4" 890 +#define MPFR_VERSION_STRING "3.1.2-p5" 891 892 /* Macros dealing with MPFR VERSION */ 893 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 894 @@ -861,7 +861,7 @@ 895 _t = (mpfr_kind_t) _k; \ 896 _s = 1; \ 897 } else { \ 898 - _t = (mpfr_kind_t) -k; \ 899 + _t = (mpfr_kind_t) - _k; \ 900 _s = -1; \ 901 } \ 902 _e = _t == MPFR_REGULAR_KIND ? (e) : \ 903 diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c 904 --- mpfr-3.1.2-a/src/version.c 2013-12-01 11:07:49.575329762 +0000 905 +++ mpfr-3.1.2-b/src/version.c 2013-12-01 11:07:49.747331585 +0000 906 @@ -25,5 +25,5 @@ 907 const char * 908 mpfr_get_version (void) 909 { 910 - return "3.1.2-p4"; 911 + return "3.1.2-p5"; 912 }
Note:
See TracChangeset
for help on using the changeset viewer.