Changeset 52b4b72 for patches/mpfr-3.1.2-fixes-4.patch
- Timestamp:
- Jul 23, 2014, 12:36:25 AM (10 years ago)
- Branches:
- clfs-3.0.0-systemd, master, systemd
- Children:
- 7703780
- Parents:
- 1393767 (diff), d923363 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
patches/mpfr-3.1.2-fixes-4.patch
r1393767 r52b4b72 1 1 Submitted By: William Harrington (kb0iic at cross-lfs dot org) 2 Date: 2014-0 5-092 Date: 2014-07-21 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 to patch level 8.6 Description: Contains all upstream patches of mpfr current to patch level 10. 7 7 8 8 diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES … … 1279 1279 + return "3.1.2-p8"; 1280 1280 } 1281 diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES 1282 --- mpfr-3.1.2-a/PATCHES 2014-06-30 15:15:25.533266905 +0000 1283 +++ mpfr-3.1.2-b/PATCHES 2014-06-30 15:15:25.617269178 +0000 1284 @@ -0,0 +1 @@ 1285 +div-overflow 1286 diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION 1287 --- mpfr-3.1.2-a/VERSION 2014-06-30 15:15:25.529266797 +0000 1288 +++ mpfr-3.1.2-b/VERSION 2014-06-30 15:15:25.617269178 +0000 1289 @@ -1 +1 @@ 1290 -3.1.2-p8 1291 +3.1.2-p9 1292 diff -Naurd mpfr-3.1.2-a/src/div.c mpfr-3.1.2-b/src/div.c 1293 --- mpfr-3.1.2-a/src/div.c 2013-03-13 15:37:33.000000000 +0000 1294 +++ mpfr-3.1.2-b/src/div.c 2014-06-30 15:15:25.585268312 +0000 1295 @@ -750,7 +750,9 @@ 1296 truncate_check_qh: 1297 if (qh) 1298 { 1299 - qexp ++; 1300 + if (MPFR_LIKELY (qexp < MPFR_EXP_MAX)) 1301 + qexp ++; 1302 + /* else qexp is now incorrect, but one will still get an overflow */ 1303 q0p[q0size - 1] = MPFR_LIMB_HIGHBIT; 1304 } 1305 goto truncate; 1306 @@ -765,7 +767,9 @@ 1307 inex = 1; /* always here */ 1308 if (mpn_add_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh)) 1309 { 1310 - qexp ++; 1311 + if (MPFR_LIKELY (qexp < MPFR_EXP_MAX)) 1312 + qexp ++; 1313 + /* else qexp is now incorrect, but one will still get an overflow */ 1314 q0p[q0size - 1] = MPFR_LIMB_HIGHBIT; 1315 } 1316 1317 diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h 1318 --- mpfr-3.1.2-a/src/mpfr.h 2014-06-30 15:15:25.533266905 +0000 1319 +++ mpfr-3.1.2-b/src/mpfr.h 2014-06-30 15:15:25.613269070 +0000 1320 @@ -27,7 +27,7 @@ 1321 #define MPFR_VERSION_MAJOR 3 1322 #define MPFR_VERSION_MINOR 1 1323 #define MPFR_VERSION_PATCHLEVEL 2 1324 -#define MPFR_VERSION_STRING "3.1.2-p8" 1325 +#define MPFR_VERSION_STRING "3.1.2-p9" 1326 1327 /* Macros dealing with MPFR VERSION */ 1328 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 1329 diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c 1330 --- mpfr-3.1.2-a/src/version.c 2014-06-30 15:15:25.533266905 +0000 1331 +++ mpfr-3.1.2-b/src/version.c 2014-06-30 15:15:25.613269070 +0000 1332 @@ -25,5 +25,5 @@ 1333 const char * 1334 mpfr_get_version (void) 1335 { 1336 - return "3.1.2-p8"; 1337 + return "3.1.2-p9"; 1338 } 1339 diff -Naurd mpfr-3.1.2-a/tests/tdiv.c mpfr-3.1.2-b/tests/tdiv.c 1340 --- mpfr-3.1.2-a/tests/tdiv.c 2013-03-13 15:37:44.000000000 +0000 1341 +++ mpfr-3.1.2-b/tests/tdiv.c 2014-06-30 15:15:25.585268312 +0000 1342 @@ -1104,6 +1104,96 @@ 1343 #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS) 1344 #include "tgeneric.c" 1345 1346 +static void 1347 +test_extreme (void) 1348 +{ 1349 + mpfr_t x, y, z; 1350 + mpfr_exp_t emin, emax; 1351 + mpfr_prec_t p[4] = { 8, 32, 64, 256 }; 1352 + int xi, yi, zi, j, r; 1353 + unsigned int flags, ex_flags; 1354 + 1355 + emin = mpfr_get_emin (); 1356 + emax = mpfr_get_emax (); 1357 + 1358 + mpfr_set_emin (MPFR_EMIN_MIN); 1359 + mpfr_set_emax (MPFR_EMAX_MAX); 1360 + 1361 + for (xi = 0; xi < 4; xi++) 1362 + { 1363 + mpfr_init2 (x, p[xi]); 1364 + mpfr_setmax (x, MPFR_EMAX_MAX); 1365 + MPFR_ASSERTN (mpfr_check (x)); 1366 + for (yi = 0; yi < 4; yi++) 1367 + { 1368 + mpfr_init2 (y, p[yi]); 1369 + mpfr_setmin (y, MPFR_EMIN_MIN); 1370 + for (j = 0; j < 2; j++) 1371 + { 1372 + MPFR_ASSERTN (mpfr_check (y)); 1373 + for (zi = 0; zi < 4; zi++) 1374 + { 1375 + mpfr_init2 (z, p[zi]); 1376 + RND_LOOP (r) 1377 + { 1378 + mpfr_clear_flags (); 1379 + mpfr_div (z, x, y, (mpfr_rnd_t) r); 1380 + flags = __gmpfr_flags; 1381 + MPFR_ASSERTN (mpfr_check (z)); 1382 + ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; 1383 + if (flags != ex_flags) 1384 + { 1385 + printf ("Bad flags in test_extreme on z = a/b" 1386 + " with %s and\n", 1387 + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); 1388 + printf ("a = "); 1389 + mpfr_dump (x); 1390 + printf ("b = "); 1391 + mpfr_dump (y); 1392 + printf ("Expected flags:"); 1393 + flags_out (ex_flags); 1394 + printf ("Got flags: "); 1395 + flags_out (flags); 1396 + printf ("z = "); 1397 + mpfr_dump (z); 1398 + exit (1); 1399 + } 1400 + mpfr_clear_flags (); 1401 + mpfr_div (z, y, x, (mpfr_rnd_t) r); 1402 + flags = __gmpfr_flags; 1403 + MPFR_ASSERTN (mpfr_check (z)); 1404 + ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; 1405 + if (flags != ex_flags) 1406 + { 1407 + printf ("Bad flags in test_extreme on z = a/b" 1408 + " with %s and\n", 1409 + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); 1410 + printf ("a = "); 1411 + mpfr_dump (y); 1412 + printf ("b = "); 1413 + mpfr_dump (x); 1414 + printf ("Expected flags:"); 1415 + flags_out (ex_flags); 1416 + printf ("Got flags: "); 1417 + flags_out (flags); 1418 + printf ("z = "); 1419 + mpfr_dump (z); 1420 + exit (1); 1421 + } 1422 + } 1423 + mpfr_clear (z); 1424 + } /* zi */ 1425 + mpfr_nextabove (y); 1426 + } /* j */ 1427 + mpfr_clear (y); 1428 + } /* yi */ 1429 + mpfr_clear (x); 1430 + } /* xi */ 1431 + 1432 + set_emin (emin); 1433 + set_emax (emax); 1434 +} 1435 + 1436 int 1437 main (int argc, char *argv[]) 1438 { 1439 @@ -1130,6 +1220,7 @@ 1440 test_20070603 (); 1441 test_20070628 (); 1442 test_generic (2, 800, 50); 1443 + test_extreme (); 1444 1445 tests_end_mpfr (); 1446 return 0; 1447 diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES 1448 --- mpfr-3.1.2-a/PATCHES 2014-06-30 15:17:53.337268149 +0000 1449 +++ mpfr-3.1.2-b/PATCHES 2014-06-30 15:17:53.417270314 +0000 1450 @@ -0,0 +1 @@ 1451 +vasprintf 1452 diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION 1453 --- mpfr-3.1.2-a/VERSION 2014-06-30 15:17:53.337268149 +0000 1454 +++ mpfr-3.1.2-b/VERSION 2014-06-30 15:17:53.413270206 +0000 1455 @@ -1 +1 @@ 1456 -3.1.2-p9 1457 +3.1.2-p10 1458 diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h 1459 --- mpfr-3.1.2-a/src/mpfr.h 2014-06-30 15:17:53.337268149 +0000 1460 +++ mpfr-3.1.2-b/src/mpfr.h 2014-06-30 15:17:53.413270206 +0000 1461 @@ -27,7 +27,7 @@ 1462 #define MPFR_VERSION_MAJOR 3 1463 #define MPFR_VERSION_MINOR 1 1464 #define MPFR_VERSION_PATCHLEVEL 2 1465 -#define MPFR_VERSION_STRING "3.1.2-p9" 1466 +#define MPFR_VERSION_STRING "3.1.2-p10" 1467 1468 /* Macros dealing with MPFR VERSION */ 1469 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 1470 diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c 1471 --- mpfr-3.1.2-a/src/vasprintf.c 2013-11-15 00:51:49.267334408 +0000 1472 +++ mpfr-3.1.2-b/src/vasprintf.c 2014-06-30 15:17:53.377269231 +0000 1473 @@ -884,14 +884,18 @@ 1474 first digit, we want the exponent for radix two and the decimal 1475 point AFTER the first digit. */ 1476 { 1477 - MPFR_ASSERTN (exp > MPFR_EMIN_MIN /4); /* possible overflow */ 1478 + /* An integer overflow is normally not possible since MPFR_EXP_MIN 1479 + is twice as large as MPFR_EMIN_MIN. */ 1480 + MPFR_ASSERTN (exp > (MPFR_EXP_MIN + 3) / 4); 1481 exp = (exp - 1) * 4; 1482 } 1483 else 1484 /* EXP is the exponent for decimal point BEFORE the first digit, we 1485 want the exponent for decimal point AFTER the first digit. */ 1486 { 1487 - MPFR_ASSERTN (exp > MPFR_EMIN_MIN); /* possible overflow */ 1488 + /* An integer overflow is normally not possible since MPFR_EXP_MIN 1489 + is twice as large as MPFR_EMIN_MIN. */ 1490 + MPFR_ASSERTN (exp > MPFR_EXP_MIN); 1491 --exp; 1492 } 1493 } 1494 diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c 1495 --- mpfr-3.1.2-a/src/version.c 2014-06-30 15:17:53.337268149 +0000 1496 +++ mpfr-3.1.2-b/src/version.c 2014-06-30 15:17:53.413270206 +0000 1497 @@ -25,5 +25,5 @@ 1498 const char * 1499 mpfr_get_version (void) 1500 { 1501 - return "3.1.2-p9"; 1502 + return "3.1.2-p10"; 1503 } 1504 diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c 1505 --- mpfr-3.1.2-a/tests/tsprintf.c 2013-11-15 00:51:49.267334408 +0000 1506 +++ mpfr-3.1.2-b/tests/tsprintf.c 2014-06-30 15:17:53.377269231 +0000 1507 @@ -1184,6 +1184,69 @@ 1508 check_emax_aux (MPFR_EMAX_MAX); 1509 } 1510 1511 +static void 1512 +check_emin_aux (mpfr_exp_t e) 1513 +{ 1514 + mpfr_t x; 1515 + char *s1, s2[256]; 1516 + int i; 1517 + mpfr_exp_t emin; 1518 + mpz_t ee; 1519 + 1520 + MPFR_ASSERTN (e >= LONG_MIN); 1521 + emin = mpfr_get_emin (); 1522 + set_emin (e); 1523 + 1524 + mpfr_init2 (x, 16); 1525 + mpz_init (ee); 1526 + 1527 + mpfr_setmin (x, e); 1528 + mpz_set_si (ee, e); 1529 + mpz_sub_ui (ee, ee, 1); 1530 + 1531 + i = mpfr_asprintf (&s1, "%Ra", x); 1532 + MPFR_ASSERTN (i > 0); 1533 + 1534 + gmp_snprintf (s2, 256, "0x1p%Zd", ee); 1535 + 1536 + if (strcmp (s1, s2) != 0) 1537 + { 1538 + printf ("Error in check_emin_aux for emin = %ld\n", (long) e); 1539 + printf ("Expected %s\n", s2); 1540 + printf ("Got %s\n", s1); 1541 + exit (1); 1542 + } 1543 + 1544 + mpfr_free_str (s1); 1545 + 1546 + i = mpfr_asprintf (&s1, "%Rb", x); 1547 + MPFR_ASSERTN (i > 0); 1548 + 1549 + gmp_snprintf (s2, 256, "1p%Zd", ee); 1550 + 1551 + if (strcmp (s1, s2) != 0) 1552 + { 1553 + printf ("Error in check_emin_aux for emin = %ld\n", (long) e); 1554 + printf ("Expected %s\n", s2); 1555 + printf ("Got %s\n", s1); 1556 + exit (1); 1557 + } 1558 + 1559 + mpfr_free_str (s1); 1560 + 1561 + mpfr_clear (x); 1562 + mpz_clear (ee); 1563 + set_emin (emin); 1564 +} 1565 + 1566 +static void 1567 +check_emin (void) 1568 +{ 1569 + check_emin_aux (-15); 1570 + check_emin_aux (mpfr_get_emin ()); 1571 + check_emin_aux (MPFR_EMIN_MIN); 1572 +} 1573 + 1574 int 1575 main (int argc, char **argv) 1576 { 1577 @@ -1203,6 +1266,7 @@ 1578 decimal (); 1579 mixed (); 1580 check_emax (); 1581 + check_emin (); 1582 1583 #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) 1584 locale_da_DK ();
Note:
See TracChangeset
for help on using the changeset viewer.