[Gmp-commit] /var/hg/gmp: 11 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Mon Oct 26 16:09:56 UTC 2020
details: /var/hg/gmp/rev/b22f374d0d4c
changeset: 18103:b22f374d0d4c
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 17:19:53 2020 +0100
description:
mini-gmp.c (mpz_out_str): Return 0 when base is out of range (spotted by Paul Eggert)
details: /var/hg/gmp/rev/cd110140c0dc
changeset: 18104:cd110140c0dc
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 17:20:15 2020 +0100
description:
mini-mpq.c (mpq_out_str): Return 0 when base is out of range.
details: /var/hg/gmp/rev/637d737dfd3e
changeset: 18105:637d737dfd3e
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 17:26:20 2020 +0100
description:
ChangeLog
details: /var/hg/gmp/rev/9c1397b7faca
changeset: 18106:9c1397b7faca
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 18:19:20 2020 +0100
description:
mini-gmp/tests/t-str.c: Test out-of-range bases for mpz_out_str
details: /var/hg/gmp/rev/ef05a13694cc
changeset: 18107:ef05a13694cc
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 18:19:39 2020 +0100
description:
mini-gmp/tests/t-mpq_str.c: Test out-of-range bases for mpq_out_str
details: /var/hg/gmp/rev/c1bbe46f6b5e
changeset: 18108:c1bbe46f6b5e
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 18:24:13 2020 +0100
description:
mini-mpq.c (mpq_canonical_sign): Use the correct type for size
details: /var/hg/gmp/rev/8f681f9fa98a
changeset: 18109:8f681f9fa98a
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 18:24:57 2020 +0100
description:
Copyright year
details: /var/hg/gmp/rev/d538363e9f55
changeset: 18110:d538363e9f55
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 18:27:49 2020 +0100
description:
tests/mpz/io.c: Test out-of-range bases for mpz_out_str
details: /var/hg/gmp/rev/053b61907877
changeset: 18111:053b61907877
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 18:30:13 2020 +0100
description:
tests/devel/Makefile.am: Remove redundancies
details: /var/hg/gmp/rev/ae2eb69d690d
changeset: 18112:ae2eb69d690d
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Oct 25 18:31:13 2020 +0100
description:
ChangeLog
details: /var/hg/gmp/rev/8881648792dc
changeset: 18113:8881648792dc
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Mon Oct 26 17:04:27 2020 +0100
description:
tests/devel/gen-test-longlong_h.c: Copyright header
diffstat:
ChangeLog | 11 ++++++++++-
mini-gmp/ChangeLog | 12 +++++++++++-
mini-gmp/mini-gmp.c | 4 +++-
mini-gmp/mini-gmp.h | 2 +-
mini-gmp/mini-mpq.c | 10 ++++++----
mini-gmp/tests/t-mpq_str.c | 12 ++++++++++++
mini-gmp/tests/t-str.c | 12 ++++++++++++
tests/devel/Makefile.am | 15 +++++----------
tests/devel/gen-test-longlong_h.c | 18 ++++++++++++++++++
tests/mpz/io.c | 15 ++++++++++++++-
10 files changed, 92 insertions(+), 19 deletions(-)
diffs (252 lines):
diff -r 69a98c5738e8 -r 8881648792dc ChangeLog
--- a/ChangeLog Sun Oct 18 08:00:15 2020 +0200
+++ b/ChangeLog Mon Oct 26 17:04:27 2020 +0100
@@ -1,11 +1,20 @@
+2020-10-25 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+ * configfsf.guess: Updated to version 2020-10-22, from gnulib.
+ * configfsf.sub: Updated to version 2020-10-13, from gnulib.
+
2020-10-17 Marco Bodrato <bodrato at mail.dm.unipi.it>
* bootstrap.c (mpz_invert_2exp): Simplify.
* mpz/stronglucas.c (mpz_oddjacobi_ui): New helper function.
+ * tests/devel/Makefile.am: Remove redundancies.
+
+ * tests/mpz/io.c: Test out-of-range bases for mpz_out_str.
+
2020-10-14 Marco Bodrato <bodrato at mail.dm.unipi.it>
- * doc/gmp.texi (Number sequences): Remove redundancie. (spotted: TonyMcC)
+ * doc/gmp.texi (Number sequences): Remove redundancy. (spotted: TonyMcC)
2020-10-06 Niels Möller <nisse at lysator.liu.se>
diff -r 69a98c5738e8 -r 8881648792dc mini-gmp/ChangeLog
--- a/mini-gmp/ChangeLog Sun Oct 18 08:00:15 2020 +0200
+++ b/mini-gmp/ChangeLog Mon Oct 26 17:04:27 2020 +0100
@@ -1,9 +1,19 @@
+2020-10-25 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+ * mini-mpq.c (mpq_canonical_sign): Use the correct type for size.
+
2020-10-18 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mini-gmp.c: Use mpn_scan1 instead of mpz_scan1.
- (mpn_set_str_bits): Reduce bramches and writes.
+ (mpn_set_str_bits): Reduce branches and writes.
(mpz_gcdext): Delay mpz_setbit (t0, ...).
+ * mini-mpq.c (mpq_out_str): Return 0 when base is out of range.
+ * mini-gmp.c (mpz_out_str): Likewise. (spotted by Paul Eggert)
+
+ * tests/t-str.c: Test out-of-range bases for mpz_out_str.
+ * tests/t-mpq_str.c: Likewise, for mpq_out_str.
+
2020-10-06 Niels Möller <nisse at lysator.liu.se>
* tests/run-tests: Better support for make check on wine or cygwin.
diff -r 69a98c5738e8 -r 8881648792dc mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c Sun Oct 18 08:00:15 2020 +0200
+++ b/mini-gmp/mini-gmp.c Mon Oct 26 17:04:27 2020 +0100
@@ -32,7 +32,7 @@
/* NOTE: All functions in this file which are not declared in
mini-gmp.h are internal, and are not intended to be compatible
- neither with GMP nor with future versions of mini-gmp. */
+ with GMP or with future versions of mini-gmp. */
/* Much of the material copied from GMP files, including: gmp-impl.h,
longlong.h, mpn/generic/add_n.c, mpn/generic/addmul_1.c,
@@ -4423,6 +4423,8 @@
size_t len, n;
str = mpz_get_str (NULL, base, x);
+ if (!str)
+ return 0;
len = strlen (str);
n = fwrite (str, 1, len, stream);
gmp_free (str, len + 1);
diff -r 69a98c5738e8 -r 8881648792dc mini-gmp/mini-gmp.h
--- a/mini-gmp/mini-gmp.h Sun Oct 18 08:00:15 2020 +0200
+++ b/mini-gmp/mini-gmp.h Mon Oct 26 17:04:27 2020 +0100
@@ -1,6 +1,6 @@
/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
-Copyright 2011-2015, 2017, 2019 Free Software Foundation, Inc.
+Copyright 2011-2015, 2017, 2019-2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff -r 69a98c5738e8 -r 8881648792dc mini-gmp/mini-mpq.c
--- a/mini-gmp/mini-mpq.c Sun Oct 18 08:00:15 2020 +0200
+++ b/mini-gmp/mini-mpq.c Mon Oct 26 17:04:27 2020 +0100
@@ -5,7 +5,7 @@
Acknowledgment: special thanks to Bradley Lucier for his comments
to the preliminary version of this code.
-Copyright 2018, 2019 Free Software Foundation, Inc.
+Copyright 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -107,10 +107,10 @@
static void
mpq_canonical_sign (mpq_t r)
{
- int cmp = mpq_denref (r)->_mp_size;
- if (cmp <= 0)
+ mp_size_t ds = mpq_denref (r)->_mp_size;
+ if (ds <= 0)
{
- if (cmp == 0)
+ if (ds == 0)
gmp_die("mpq: Fraction with zero denominator.");
mpz_neg (mpq_denref (r), mpq_denref (r));
mpz_neg (mpq_numref (r), mpq_numref (r));
@@ -515,6 +515,8 @@
void (*gmp_free_func) (void *, size_t);
str = mpq_get_str (NULL, base, x);
+ if (!str)
+ return 0;
len = strlen (str);
n = fwrite (str, 1, len, stream);
mp_get_memory_functions (NULL, NULL, &gmp_free_func);
diff -r 69a98c5738e8 -r 8881648792dc mini-gmp/tests/t-mpq_str.c
--- a/mini-gmp/tests/t-mpq_str.c Sun Oct 18 08:00:15 2020 +0200
+++ b/mini-gmp/tests/t-mpq_str.c Mon Oct 26 17:04:27 2020 +0100
@@ -160,6 +160,18 @@
fprintf (stderr,
"Failed to create temporary file. Skipping mpq_out_str tests.\n");
+ if (mpq_out_str (tmp, 63, a) != 0)
+ {
+ printf ("mpq_out_str did not return 0 (error) with base > 62\n");
+ abort ();
+ }
+
+ if (mpq_out_str (tmp, -37, a) != 0)
+ {
+ printf ("mpq_out_str did not return 0 (error) with base < -37\n");
+ abort ();
+ }
+
for (i = 0; i < COUNT/60; i++)
{
int base;
diff -r 69a98c5738e8 -r 8881648792dc mini-gmp/tests/t-str.c
--- a/mini-gmp/tests/t-str.c Sun Oct 18 08:00:15 2020 +0200
+++ b/mini-gmp/tests/t-str.c Mon Oct 26 17:04:27 2020 +0100
@@ -156,6 +156,18 @@
fprintf (stderr,
"Failed to create temporary file. Skipping mpz_out_str tests.\n");
+ if (mpz_out_str (tmp, 63, a) != 0)
+ {
+ printf ("mpz_out_str did not return 0 (error) with base > 62\n");
+ abort ();
+ }
+
+ if (mpz_out_str (tmp, -37, a) != 0)
+ {
+ printf ("mpz_out_str did not return 0 (error) with base < -37\n");
+ abort ();
+ }
+
for (i = 0; i < COUNT; i++)
{
int base;
diff -r 69a98c5738e8 -r 8881648792dc tests/devel/Makefile.am
--- a/tests/devel/Makefile.am Sun Oct 18 08:00:15 2020 +0200
+++ b/tests/devel/Makefile.am Mon Oct 26 17:04:27 2020 +0100
@@ -25,13 +25,9 @@
EXTRA_PROGRAMS = \
sqrtrem_1_2 primes try test-add_ssaaaa test-sub_ddmmss
-BUILT_SOURCES =
-DISTCLEANFILES = $(BUILT_SOURCES)
-EXTRA_DIST =
+EXTRA_DIST = gen-test-longlong_h.c
-nodist_SOURCES = test-add_ssaaaa.c test-sub_ddmmss.c
-
-allprogs: $(EXTRA_PROGRAMS) test-add_ssaaaa test-sub_ddmmss
+allprogs: $(EXTRA_PROGRAMS)
CLEANFILES = $(EXTRA_PROGRAMS)
@@ -40,13 +36,12 @@
test-add_ssaaaa.c: gen-test-longlong_h$(EXEEXT_FOR_BUILD)
./gen-test-longlong_h add >test-add_ssaaaa.c || (rm -f test-add_ssaaaa.c; exit 1)
-#BUILT_SOURCES += test-add_ssaaaa.c
+CLEANFILES += test-add_ssaaaa.c
test-sub_ddmmss.c: gen-test-longlong_h$(EXEEXT_FOR_BUILD)
./gen-test-longlong_h sub >test-sub_ddmmss.c || (rm -f test-sub_ddmmss.c; exit 1)
-#BUILT_SOURCES += test-sub_ddmmss.c
+CLEANFILES += test-sub_ddmmss.c
gen-test-longlong_h$(EXEEXT_FOR_BUILD): gen-test-longlong_h.c
$(CC_FOR_BUILD) `test -f 'gen-test-longlong_h.c' || echo '$(srcdir)/'`gen-test-longlong_h.c -o gen-test-longlong_h$(EXEEXT_FOR_BUILD)
-DISTCLEANFILES += gen-test-longlong_h$(EXEEXT_FOR_BUILD)
-EXTRA_DIST += gen-test-longlong_h.c
+CLEANFILES += gen-test-longlong_h$(EXEEXT_FOR_BUILD)
diff -r 69a98c5738e8 -r 8881648792dc tests/devel/gen-test-longlong_h.c
--- a/tests/devel/gen-test-longlong_h.c Sun Oct 18 08:00:15 2020 +0200
+++ b/tests/devel/gen-test-longlong_h.c Mon Oct 26 17:04:27 2020 +0100
@@ -1,3 +1,21 @@
+/*
+Copyright 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
diff -r 69a98c5738e8 -r 8881648792dc tests/mpz/io.c
--- a/tests/mpz/io.c Sun Oct 18 08:00:15 2020 +0200
+++ b/tests/mpz/io.c Mon Oct 26 17:04:27 2020 +0100
@@ -1,6 +1,7 @@
/* Test conversion and I/O using mpz_out_str and mpz_inp_str.
-Copyright 1993, 1994, 1996, 2000, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000, 2001, 2012, 2020 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library test suite.
@@ -63,6 +64,18 @@
fp = fopen (FILENAME, "w+");
+ if (mpz_out_str (fp, 63, op1) != 0)
+ {
+ printf ("mpz_out_str did not return 0 (error) with base > 62\n");
+ abort ();
+ }
+
+ if (mpz_out_str (fp, -37, op1) != 0)
+ {
+ printf ("mpz_out_str did not return 0 (error) with base < -37\n");
+ abort ();
+ }
+
for (i = 0; i < reps; i++)
{
mpz_urandomb (bs, rands, 32);
More information about the gmp-commit
mailing list