Re: On being welcoming

2015-12-20 Thread Marco Bodrato
Ciao, Il Ven, 18 Dicembre 2015 4:51 pm, Niels Möller ha scritto: > I can only speak for myself, but I have pretty limited hacking time for > my spare-time projects. And when I get some quality time when I'm at my > best, and able to de some real hacking, I prefer doing the hacking. > > Which means

Re: gmp-impl.h assumes 32-bit unsigned int in fft_table_nk

2015-12-20 Thread Marco Bodrato
Ciao, Il Sab, 19 Dicembre 2015 5:09 am, Robert Baruch ha scritto: > Oh, BTW, there is also the same problem in mpn/trialdiv.c:68, where > gmp_primes_tab has a 24-bit field in an unsigned int. Uhm... unsigned int idx:24;/* index of first primes in dtab */ Makefile asks gen-trialdivtab to ge

Re: 't-locale' test build failure using MinGW-W64

2016-01-01 Thread Marco Bodrato
Ciao, Il Mer, 23 Dicembre 2015 4:23 pm, sav...@ukr.net ha scritto: > Used stuff: > - Windows 10, I do not have any dos machine to test on, but ... > After applying patches I made GMP builds using MinGW-W64 for > + configurations and all tests ran successfully ... I tested your patches on my Deb

Re: Re[2]: 't-locale' test build failure using MinGW-W64

2016-01-02 Thread Marco Bodrato
Ciao, Il Sab, 2 Gennaio 2016 7:51 am, sav...@ukr.net ha scritto: > От кого: "Marc Glisse" > IIUC, the goal is for the test to end up in > >printf ("Test skipped, replacing localeconv/nl_langinfo doesn't > work\n"); > > if replacing localeconv is disabled on that platform? That seems sensible

Re: Ship new config.guess file

2016-01-04 Thread Marco Bodrato
Ciao, Il Lun, 4 Gennaio 2016 6:40 pm, Timothy Pearson ha scritto: > The config.guess file currently shipping with GMP 6.1.0 is severely > outdated (2012), leading to build failures on ppc64el due to not being > able to detect the CPU and system type. Updating the config.guess file > to a modern v

Re: Ship new config.guess file

2016-01-04 Thread Marco Bodrato
Ciao, Il Lun, 4 Gennaio 2016 8:03 pm, Timothy Pearson ha scritto: > Failing configure log: > checking build system type... ../mpfr-3.1.2/config.guess: unable to > guess system type > > This script, last modified 2012-02-10, has failed to recognize MPFR 3.1.2 was released in the early 2013. I sug

Re: Ship new config.guess file

2016-01-05 Thread Marco Bodrato
Ciao, Il Mar, 5 Gennaio 2016 4:34 pm, Timothy Pearson ha scritto: > I guess that's what I get for being a bit too swamped on my first day > back after the new year... :-) If you started the year using GMP and MPFR, it will be a good year !-) Regards, m -- http://bodrato.it/ __

Re: Typo in the manual, and clarification for mpn_gcd

2017-01-10 Thread Marco Bodrato
Ciao, Il Dom, 1 Gennaio 2017 9:59 pm, Max Horn ha scritto: > (1) In section 15.1.5 "Higher degree Toom’n’half" there is a typo: > "equanl" should be "equal". > (Also, I never heard the expression "four-plets" -- perhaps "quadruplets" > are meant? Done, thanks! Regards, m -- http://bodrato.it/

Re: Problem with gmp_randinit_set

2017-02-18 Thread Marco Bodrato
Ciao, Il Ven, 17 Febbraio 2017 11:04 pm, Niels Möller ha scritto: >> ni...@lysator.liu.se (Niels Möller) writes: >> >> Or if we want to take advantage of the structure, we need an mpn >> function to reduce numbers modulo 2^19937 - 20023. > > Below is a sketch for the 64-bit case, not yet working.

Re: Problem with gmp_randinit_set

2017-02-19 Thread Marco Bodrato
Ciao, Il Dom, 19 Febbraio 2017 9:21 am, Niels Möller ha scritto: > But shifting, as you suggest, might be simpler, using > > 2 B^623 = 20023 (mod p) A possible generalization follows: #include #include #include #include #define GSIZE (19937 / GMP_NUMB_BITS) #define GSHIFT (19937 % GMP_NUM

Re: Problem with gmp_randinit_set

2017-02-21 Thread Marco Bodrato
Ciao, Il Sab, 18 Febbraio 2017 12:42 am, Pedro Gimeno ha scritto: > Yes. Only seeds up to 2^19937-20028 inclusive are guaranteed to generate > different sequences, though, and with the new seeding function, only up to > 2^19936-1. I don't think it'd be a big deal to cut it out to 2^19936-1 I'm lo

Re: Problem with gmp_randinit_set

2017-03-02 Thread Marco Bodrato
Ciao, Il Mar, 21 Febbraio 2017 5:14 pm, Pedro Gimeno ha scritto: > Marco Bodrato wrote, On 2017-02-21 15:21: >> value and (2^n-k-value) will be mangled to the same seed... >> > > Well, these are more bugs then. > As I said it's all or nothing. Either compatibility

Re: Problem with gmp_randinit_set

2017-03-02 Thread Marco Bodrato
Ciao, Il Ven, 3 Marzo 2017 3:10 am, Pedro Gimeno ha scritto: > Marco Bodrato wrote, On 2017-03-02 21:37: > Just one comment. You're switching algorithms for the top half. Wouldn't > it be easier to change the key (the k[] array) instead? That might also > produce less co

Re: mpz_powm_ui () for 5.1.2

2017-03-07 Thread Marco Bodrato
Ciao, Il 2017-03-08 02:17 shen lixing ha scritto: I installed MinGW, then 'mingw-get install mingw32-gmp' , got the gmp 5.1.2 properly. The last release of the library is 6.1.2 . unsigned long long c = 10307e7 - 1; // change c,start point mpz_set_ui(b,c); mpz_mul_ui(b,b,

Re: Bug Upon Make Check

2017-03-19 Thread Marco Bodrato
Ciao, Il Dom, 19 Marzo 2017 6:41 pm, David Hadaller ha scritto: > 1 of 58 tests failed With test? You are not giving any information... > make[4]: Leaving directory '/home/david/Downloads/gmp-4.3.2/tests/mpz' ... anyway, the last release is GMP-6.1.2, please try that. Have a nice GMP experien

Re: fat_init violates host ABI on Win64

2017-04-26 Thread Marco Bodrato
Ciao, Il Mer, 26 Aprile 2017 12:25 pm, Nicolas Hake ha scritto: > Torbjörn Granlund wrote: >> Where do we (unconditionally) rely on variable-length arrays? > > mpn/generic/sqrlo_basecase.c line 153, where SQRLO_BASECASE_ALLOC is a > non-constant expression by ultimately referencing CPUVEC_THRESHOL

Re: GMP 6.1.2 t-count_zeros failure on ARM with assertions

2017-12-27 Thread Marco Bodrato
Ciao, Il Mer, 27 Dicembre 2017 6:10 pm, Marc Glisse ha scritto: > On Wed, 27 Dec 2017, Niels Möller wrote: >> And below, a patch to delete all mention of COUNT_LEADING_ZEROS_0, >> except for tune/many.pl, which I'm not familiar with. What do you think? > It seems a bit sad to drop this informatio

Re: rsblsh2_n.asm

2018-02-19 Thread Marco Bodrato
Ciao, Il Mer, 14 Febbraio 2018 10:29 am, paul zimmermann ha scritto: > in gmp-6.1.2 (and in the daily snapshot gmp-6.1.99-20180214), the head of > mpn/rsblsh2_n.asm on x86_64 says: > > dnl AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 1) - up[] > > I guess it should be: > > dnl AMD64 mpn_rsblsh2_n -- r

Re: speed -P

2018-03-18 Thread Marco Bodrato
Ciao, Il Gio, 15 Marzo 2018 10:56 am, paul zimmermann ha scritto: > there is a bug in the -P option of speed in GMP 6.1.2: > A workaround is to add "set termoption noenhanced" in the foo.gnuplot > file. Applied your suggestion: https://gmplib.org/repo/gmp/rev/ae0751feae31 Thanks, m __

Re: documentation on internals not up to date

2018-04-26 Thread Marco Bodrato
Ciao, Il Lun, 9 Aprile 2018 5:30 pm, Trevor Spiteri ha scritto: > The documentation on the internals is still saying that: [...] > But in the current repository state, that is no longer the case. Yes, we currently have: Currently there's always at least one limb allocated, so for instance @code{

Re: documentation on internals not up to date

2018-04-26 Thread Marco Bodrato
Ciao, Il Ven, 27 Aprile 2018 7:21 am, Niels Möller ha scritto: > Since this is the section on internals, I think it's appropriate to > document. _mp_alloc == 0 and _mp_size == 0 means that value is zero, and ... I'd move the discussion on gmp-devel. Ĝis, m -- http://bodrato.it/papers/ ___

Re: printf/repl-vsnprintf.c bug (was: GMP|MPIR|MPFR assertions)

2018-05-15 Thread Marco Bodrato
Ciao, Il Gio, 18 Gennaio 2018 4:07 pm, Vincent Lefevre ha scritto: > On 2018-01-18 14:16:41 +0100, Vincent Lefevre wrote: >> printf/repl-vsnprintf.c seems buggy for floating-point specifiers >> (EeGgFf). Replace "break" by "goto next" (2 occurrences)? > > Proposed patch attached. Not tested. Test

Re: Likely GMP bug

2018-05-26 Thread Marco Bodrato
Ciao, Il Ven, 25 Maggio 2018 2:10 pm, Niels Möller ha scritto: > That fails with undefined behavior if by chance t == 2^31, so that c == > 31. > > I don't see how that can happen, though, since ulimb, vlimb < 2^31 > through out the loop, and t = (ulimb - vlimb) mod 2^32. ... but can jump inside t

Re: Likely GMP bug

2018-05-26 Thread Marco Bodrato
Ciao, Il Sab, 26 Maggio 2018 10:47 am, Niels Möller ha scritto: > "Marco Bodrato" writes: >> That's the culprit: >> >> if (size > 1) >> { >> ulimb = MPN_MOD_OR_MODEXACT_1_ODD (up, size, vlimb); >> goto strip_u_maybe; &g

Re: Likely GMP bug

2018-05-26 Thread Marco Bodrato
Ciao, Il Sab, 26 Maggio 2018 12:26 pm, Marco Bodrato ha scritto: > In my opinion, both cases (x >> 32) == x and (x >> 32) == 0 do not give a > miscomputation, Thinking twice about this... I fear (x >> 32) == x is a problem. If V is an odd 32-bits number with a factor in

Re: Likely GMP bug

2018-05-26 Thread Marco Bodrato
Ciao, Il Sab, 26 Maggio 2018 11:12 pm, Niels Möller ha scritto: > t...@gmplib.org (Torbjörn Granlund) writes: > >> I think we should rewrite relevant parts and avoid these constructs. > It would help clarity if we could reduce number of variants. If we > delete the unused USE_ZEROTAB code and the

Re: Likely GMP bug

2018-05-26 Thread Marco Bodrato
Ciao, Il Sab, 26 Maggio 2018 11:01 pm, Niels Möller ha scritto: > "Marco Bodrato" writes: > shift, that is interpreted as the odd value 2^32+1. This number has the > factorization 641 * 6700417, and if v happens to be a multiple of one of > And we have potential miscpump

Re: Likely GMP bug

2018-05-27 Thread Marco Bodrato
Ciao, Il Dom, 27 Maggio 2018 12:09 am, Marco Bodrato ha scritto: > Il Sab, 26 Maggio 2018 11:01 pm, Niels Möller ha scritto: >> Is it possible to construct some examples with v a multiple of 641, and >> input U such that ulimb = 2^31 after reduction? > factor = 6

Re: Likely GMP bug

2018-05-27 Thread Marco Bodrato
Ciao, Il Sab, 26 Maggio 2018 11:01 pm, Niels Möller ha scritto: > Is it possible to construct some examples with v a multiple of 641, and > input U such that ulimb = 2^31 after reduction? It was hard, but we got it: https://gmplib.org/repo/gmp/rev/1f8a8fefb5c2 The bug is triggered not only for 3

Re: Likely GMP bug

2018-05-28 Thread Marco Bodrato
Il Lun, 28 Maggio 2018 4:39 pm, Torbjörn Granlund ha scritto: > I assume this bug is now fixed, and so I will remove the test failure > file. The test suite now checks for this bug, for every run with --disable-assembly. So yes, you can remove the failure file, it will be recreated if some asm imp

Re: Likely GMP bug

2018-05-29 Thread Marco Bodrato
Ciao, Il Lun, 28 Maggio 2018 10:00 pm, Niels Möller ha scritto: > I'd suggest the below (complete file, I think that's more readable The code is clean. You removed all gotos... > The last part of the function requires vlimb odd, but tolerates > arbitrary u, including 0. ... the effect is that

Re: Likely GMP bug

2018-05-30 Thread Marco Bodrato
Ciao, Il Mer, 30 Maggio 2018 10:20 am, Niels Möller ha scritto: > "Marco Bodrato" writes: > Thinking about micro optimizations... Consider >> count_trailing_zeros (c, ulimb); >> ulimb = (ulimb >> 1) >> c; > vs >> count_tra

Re: mini-gmp: error: no previous prototype for 'mpz_lucas_mod'

2019-01-01 Thread Marco Bodrato
Ciao, Il Lun, 31 Dicembre 2018 10:01 am, Niels Möller ha scritto: > Vincent Lefevre writes: > >> I get the following error when compiling mini-gmp.c: >> >> mini-gmp.c:3486:1: error: no previous prototype for 'mpz_lucas_mod' >> [-Werror=missing-prototypes] >> 3486 | mpz_lucas_mod (mpz_t V, mpz_t

Re: Asserts considered harmful (or GMP spills its sensitive information)

2019-01-03 Thread Marco Bodrato
Ciao, Il Lun, 31 Dicembre 2018 7:03 pm, Jeffrey Walton ha scritto: [...skipping opinions...] > Here's a small example of triggering an assert using the Nettle > library. This absolutely is NOT a "small example", it requires to build two entire libraries! Anyway we analysed it, see below. > ARM

Re: Asserts considered harmful (or GMP spills its sensitive information)

2019-01-03 Thread Marco Bodrato
Ciao, I'm not sending to oss-security... They does not seem to be interested. Il Gio, 3 Gennaio 2019 9:42 pm, Jeffrey Walton ha scritto: > On Thu, Jan 3, 2019 at 2:55 PM Marco Bodrato > wrote: >> This absolutely is NOT a "small example", it requires to build two &

Re: ISO C forbids an empty translation unit again

2019-09-02 Thread Marco Bodrato
Ciao, Il Lun, 2 Settembre 2019 11:48 pm, Dennis Clarke ha scritto: > This one pops up now and again if I go with LLVM/Clang on FreeBSD and > with really strict CFLAGS. So in a few files I had to drop in a silly > typedef. Adding silly lines in the code is not a priority for this project :-D By

Re: ISO C forbids an empty translation unit again

2019-09-06 Thread Marco Bodrato
Ciao, Il Lun, 2 Settembre 2019 11:48 pm, Dennis Clarke ha scritto: > t-get_str.c +69:30: error: format specifies type 'void *' but the > argument has type 'const char *' [-Werror,-Wformat-pedantic] >printf (" want %p\n", want); >~~ ^~~~ >

Re: Undefined behavior in t-sqrlo test

2019-09-20 Thread Marco Bodrato
Ciao, Il Ven, 20 Settembre 2019 5:33 pm, Andrew Wock ha scritto: > The t-sqrlo test invokes undefined behavior. Yes, also Valgrind detects it... > The mpn_ptr scratch as well as the boundary values of the mpn_ptr pp are > uninitialized values. Not exactly, only scratch is uninitialised. > I wa

Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang

2019-11-08 Thread Marco Bodrato
Ciao, Il Ven, 8 Novembre 2019 4:59 pm, Niels Möller ha scritto: > Hans Åberg writes: > >> How about memory allocations? — There is info here, suggesting >> uninitialized memory access in the test suite: Our priority is to avoid bugs in the library. So that we usually pay more attention to the li

Re: Compiling for ARMv8-A Using GCC 7.2.0 - Assertion error in gen-fac

2019-12-07 Thread Marco Bodrato
Ciao, Il Ven, 6 Dicembre 2019 3:55 pm, Torbjörn Granlund ha scritto: > ni...@lysator.liu.se (Niels Möller) writes: > > > From my understanding this might be a difference in how GCC 7.2.0 > > handles unsigned longs vs GCC 4.8.5. > > Can you file a gcc bug? These constants are defined as > Th

Re: assertion failure in snprntffuns.c:79 for i686-w64-mingw32

2020-01-10 Thread Marco Bodrato
Ciao, Il 2020-01-10 14:12 Vincent Lefevre ha scritto: On 2020-01-10 08:44:13 +0100, Niels Möller wrote: Vincent Lefevre writes: > FAIL: t-printf > == > The failing code is > > ret = vsnprintf (d->buf, avail, fmt, ap); > if (ret == -1) > { > ASSER

Re: assertion failure in snprntffuns.c:79 for i686-w64-mingw32

2020-01-11 Thread Marco Bodrato
Ciao, Il Ven, 10 Gennaio 2020 5:04 pm, Vincent Lefevre ha scritto: > On 2020-01-10 16:27:31 +0100, Marco Bodrato wrote: >> Can you please try with the development version? > I get the following error: > gmp_vsnprintf return value wrong ... because there was an error in the p

Re: efficiency bug in mpz_powm_ui?

2020-02-29 Thread Marco Bodrato
Ciao, Il 2020-02-29 11:54 paul zimmermann ha scritto: it seems that mpz_powm_ui is highly inefficient when BASE^EXP has about the same size as MOD, in which case it could first compute BASE^EXP exactly, then perform only one reduction: You are right, mpz_powm_ui does not implement an algorit

Re: Upstream patch to remove abort() that occur during memory overflow

2020-09-13 Thread Marco Bodrato
Ciao, Il 2020-09-03 19:22 ni...@lysator.liu.se ha scritto: Mustafa Mohamad writes: Currently GMP aborts which sends SIGBART and forcibly aborts Julia or any linked program. With the above patch, GMP will instead throw a __GMP_ALLOC_OVERFLOW_FUNC Instead of forcibly aborting Hi, I unders

Re: mini-gmp.h FILE test update from gmp.h

2020-09-17 Thread Marco Bodrato
Ciao, Il 2020-09-16 14:35 Vincent Lefevre ha scritto: In mini-gmp/mini-gmp.h, concerning FILE tests: /* This long list taken from gmp.h. */ but the list in GMP 6.2.0 and the current repository is not up-to-date. I re-synced the lists, thanks! Ĝis, m _

Re: overflow in mpz type with a simple mpz_add_ui

2020-09-21 Thread Marco Bodrato
Ciao, Il 2020-09-21 18:16 t...@gmplib.org ha scritto: overflow. The overflow detection flags some false positives, which is by design. But maybe we could avoid the false positive at least for the following example: #include #include "gmp.h" int main (void) { mpz_t z; mpz_init (z);

Re: gmp 6.2.0 documentation bug

2020-09-29 Thread Marco Bodrato
Ciao, Il 2020-09-29 16:09 TonyMcC ha scritto: I think there is a word (a function name?) missing from the documentation for gmp 6.2.0. In gmp.texi, at line 2541 it reads: "it's probably best to call to get a starting point and iterate from there." Should there be a function name after "call

Re: GMP bug (?) - unable to build for ARM64 with assembly enabled

2020-10-14 Thread Marco Bodrato
Il 2020-10-14 21:28 t...@gmplib.org ha scritto: Andreas Buff writes: Latest snapshot is from may though There is one made every day. Look for a filename starting with gmp-6.2.0-202010... Then please follow up here! Ĝis, m ___ gmp-bugs mailing

Re: Make check fails on samsung S8 (2)

2020-10-28 Thread Marco Bodrato
Ciao Marc, Il 2020-08-22 19:39 Marc Glisse ha scritto: Ah, on your OS nl_langinfo is defined inline as a static function in langinfo.h, so the hack used in the test of redefining the function cannot work. I guess we are supposed to add some configure check that nl_langinfo can be redefined... al

Re: Make check fails on samsung S8 (2)

2020-11-01 Thread Marco Bodrato
Ciao Luc, Il 2020-10-29 08:39 Marc Glisse ha scritto: I think so, yes. Maybe Luc can confirm if that works? Could you try if the latest available snapshot is working in your environment? You can download it at: https://gmplib.org/download/snapshot/gmp-6.2/gmp-6.2.0-20201101220635.tar.zst Ĝ

Re: possible miscompilation on macOS Catalina 10.15.6

2020-11-01 Thread Marco Bodrato
Ciao, Il 2020-10-29 20:02 Niels Möller ha scritto: Paul Koning writes: There is another possibility: GMP might be doing something undefined, where previous compilers did "what we want" while some recent new ones do something different. So you have to forgive GMP developers of not being thr

Re: 6.2.0 build failure on x86_64 Skylake PC - FIX

2020-11-01 Thread Marco Bodrato
Ciao Ralph, Il 2020-05-30 21:12 tsurzin ha scritto: The PC is running Msys2 under Windows 10 and without change GMP failed to build. Can you test if the latest available snapshot is working in your environment? You can download it at: https://gmplib.org/download/snapshot/gmp-6.2/gmp-6.2.0-2

Re: COFF_TYPE on x86_64

2020-11-01 Thread Marco Bodrato
Ciao Jeremy, Il 2020-10-02 20:45 Jeremy Drake ha scritto: Looking at the ld code, it only generated the thunk in the import library if it thought the symbol was a function. Checking the output of gcc -S showed that it added ".def func; .scl 2; .type 32; .endef" to functions, and inserting tha

Re: GMP Problem with % under C++

2020-11-05 Thread Marco Bodrato
Ciao, Il 2020-11-05 22:27 Niels Möller ha scritto: I think this is the same result you get with a plain (64-bit) long. The / and % operators in C++ produce a quotient rounded towards 0, so (f(1) - b) / DECKSIZE == 0, and the corresponding remainder is negative. I'm not that familiar with perl

Re: with strict C99 the tests/mpz/convert.c needs #include

2020-11-08 Thread Marco Bodrato
Ciao, Il 2020-11-08 00:45 Dennis Clarke ha scritto: However the tests blow up due to : convert.c:143:11: error: implicit declaration of function 'strcasecmp' is invalid in C99 That file will be changed in the next release. Please look if the applied patch fits your needs. https://gmplib.org

Re: 6.2.0 build failure on x86_64 Skylake PC - FIX

2020-11-10 Thread Marco Bodrato
Il 2020-06-08 21:52 Marc Glisse ha scritto: [handle *-*-msys exactly the same as *-*-mingw* in configure.ac] configfsf.guess does mention a triple *-pc-msys, so I guess it makes sense to handle it (or replace it with something we already handle). I don't really know in what ways it differs fro

Re: Make check fails on samsung S8 (2)

2020-12-04 Thread Marco Bodrato
Ciao Luc, Il Gio, 3 Dicembre 2020 5:03 pm, Luc Sanselme ha scritto: > I ran make check on termux on my phone and It's OK now. Great, thank you! Then, also the new release GMP-6.2.1 should be OK. Ĝis, m ___ gmp-bugs mailing list gmp-bugs@gmplib.org ht

Re: A message bug. At least Version 6.2.0

2021-01-02 Thread Marco Bodrato
Ciao, Il 2020-12-22 15:55 Guillermo Monguia ha scritto: In mini-gmp.c function mpz_export, when calling gmp_die("mpz_import: ...") instead of gmp_die("mpz_export: ...") Corrected, thanks! https://gmplib.org/repo/gmp/rev/6fed56750f6f Ĝis, m ___ gmp-

Re: error during configuration

2021-02-08 Thread Marco Bodrato
Dear Bence Lovász, Il 2021-02-08 15:20 Bence Lovász ha scritto: I want to benchmark a Graviton2 machine in AWS that has a beefy ARM cpu. I attached the output of the script. Please give me some guidelines to fix it! Did you read the file you sent us? The last line of the log you attach says:

t-scan from GMP-4.3.2 [was: t-lucnum_ui segfaults]

2021-02-28 Thread Marco Bodrato
Ciao, Il 2021-02-28 20:41 Paul Dufresne ha scritto: PASS: t-lucnum_ui t-lucnum_ui does not segfault, it passes. /bin/bash : ligne 4 : 116921 Erreur de segmentation  (core dumped) ${dir}$tst FAIL: t-scan t-scan triggers the error. make[2] : on quitte le répertoire « /home/paul/gpc2/gcc-

Re: Upstream patch to remove abort() that occur during memory overflow

2021-06-12 Thread Marco Bodrato
Il 2020-09-13 11:38 t...@gmplib.org ha scritto: Marco Bodrato writes: With ABI=64 I get: 16777216 ^ 768614336404564651 = 256 With ABI=32 I get: 16777216 ^ 178956971 = 256 Not a signal, nor an abort, simply an incorrect result :-) That's undesirable. I thought we cought over

Re: Rounding error

2021-08-27 Thread Marco Bodrato
Ciao, Il 2021-08-25 05:54 Frank Heckenbach ha scritto: mpf_get_str seems to round incorrectly sometimes. In this test program, the digits around 809 are "...244594553...", so it should round to "...244595", but it outputs "...244594". Here, your report says that you expected a "rounded" result

Re: Segmentation fault with mpz_inp_raw on gcc45

2021-09-17 Thread Marco Bodrato
Ciao, Il 2021-09-16 23:27 Torbjörn Granlund ha scritto: Going from byte count to bit count to limb count is non-trivial without risking overflow, even if the end result will typically be smaller than the incoming byte count (assuming we're not using gmp/asl.h with tiny Yes, but, should we real

Re: Segmentation fault with mpz_inp_raw on gcc45

2021-09-26 Thread Marco Bodrato
Ciao, Il 2021-09-18 10:07 Torbjörn Granlund ha scritto: I suppose that, in this case, as my fix has problems with nails, this Your fix also aborts, instead of returning 0. might be a better patch. An UNLIKELY(...) might have a place here, though. I commited the patch, adding UNLIKELY to a

Re: macOS version detection broken in configure

2021-10-21 Thread Marco Bodrato
Il 2021-10-21 16:31 ni...@lysator.liu.se ha scritto: Marc Glisse writes: From a quick look at the mailing list and the git repository, it seems to have been entirely unmaintained for more than 2 years now :-( Ouch, not being much of a libtool user myself, I hadn't noticed that. But maybe a

Re: GMP 6.2.1 Aborting when running tuneup program in one.cold()

2021-10-21 Thread Marco Bodrato
Ciao Simon, Il 2021-10-20 16:09 Simon Sobisch ha scritto: Questions: * Should I care running tuneup at all? The application does some heavy computations with it in the range +-9 (mostly multiply and divide [often by 10] and 9 fits in 63 bits, correct? Fo

Re: Fwd: math/gmp FreeBSD 12.2 Ports build failure on sparc64

2021-11-05 Thread Marco Bodrato
Il 2021-11-05 15:12 Torbjörn Granlund ha scritto: Alex Dupre writes: tmp-gcd_11.s: Assembler messages: tmp-gcd_11.s:210: Error: Illegal operands tmp-gcd_11.s:211: Error: Illegal operands tmp-gcd_11.s:212: Error: Illegal operands Above, we saw line numbers... root@freebsd12:/usr/

Re: mpz_gcd_ui(NULL, ...) with small limbs

2022-01-31 Thread Marco Bodrato
Ciao, Il Sab, 22 Gennaio 2022 11:40 pm, Marc Glisse ha scritto: > mpz_gcd_ui also contains special code for the case > where op2 (an unsigned long) does not fit in a limb. And that code calls > mpz_gcd without checking if the first argument is NULL. That probably does > not affect any platform, si

Re: Errors making GMP621 on SCO Openserver 6.

2022-02-03 Thread Marco Bodrato
Ciao, Il 2022-02-02 23:40 Jack Tearle ha scritto: I hope the only problem is my doing something wrong. Maybe. Of course we can not know what you are doing. We usually suggest to read the manual page https://gmplib.org/manual/Reporting-Bugs before reporting problems. I see the following:

Re: Errors making GMP621 on SCO Openserver 6.

2022-02-03 Thread Marco Bodrato
Ciao, Il 2022-02-03 23:08 Jack Tearle ha scritto: I deleted /bin/sh, and linked /bin/bash to /bin/sh, and then re-ran the entire installation in a new directory. The results are not quite the same.  The .libs directory is now created, but it is empty and assert.o and the rest of the programs

Re: Errors making GMP621 on SCO Openserver 6.

2022-02-04 Thread Marco Bodrato
Ciao, Il 2022-02-04 15:57 Jack Tearle ha scritto: Just to be clear, I purged the directory (rm -r *)  and extracted (tar xvf ../gmp621.tar) the published tar file for each run. You mean one of the gmp-6.2.1.tar.* files from https://ftp.gnu.org/gnu/gmp/ or https://gmplib.org/download/gmp/ , g

Re: 2 minor issues on Windows

2022-02-07 Thread Marco Bodrato
Ciao, Il Gio, 3 Febbraio 2022 8:50 am, Niels Möller ha scritto: > George Woltman writes: >> I get this compiler warning calling mpz_tstbit: warning C4244: >> 'argument': >> conversion from 'uint64_t' to 'mp_bitcnt_t', possible loss of data >> Yes, I'm creating mpz values with more than 4 billio

Re: 2 minor issues on Windows

2022-02-07 Thread Marco Bodrato
Ciao, Il Gio, 3 Febbraio 2022 8:50 am, Niels Möller ha scritto: > George Woltman writes: >> I get this compiler warning calling mpz_tstbit: warning C4244: >> 'argument': >> conversion from 'uint64_t' to 'mp_bitcnt_t', possible loss of data >> Yes, I'm creating mpz values with more than 4 billio

Re: mpz_gcd_ui(NULL, ...) with small limbs

2022-02-08 Thread Marco Bodrato
Ciao Marc, Il 2022-01-22 23:40 Marc Glisse ha scritto: the documentation for mpz_gcd_ui(rop, op1, op2) says "If rop is not NULL, store the result there." and indeed the main code contains two tests "if (w != NULL)". However, mpz_gcd_ui also contains special code for the case where op2 (an unsign

Re: mpz_gcd_ui(NULL, ...) with small limbs

2022-02-08 Thread Marco Bodrato
Ciao Marc, Il 2022-02-08 10:05 Marc Glisse ha scritto: Makes sense to me. I am just not sure if 3 is the right number and if we are consistent about it. Shouldn't 2 be enough? Or is it to be safe You are right. 2 should be enough. I think that if a not realloc-able mpz is used as a target for

Re: 2 minor issues on Windows

2022-03-12 Thread Marco Bodrato
Ciao, Il 2022-02-03 08:50 ni...@lysator.liu.se ha scritto: George Woltman writes: Minor issue #2 (I should have reported this years ago, sorry): In gmp.h, these lines: mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n) [...] *__gmp_rp = (- *__gmp_up) & GMP_NUMB_MASK;

Re: 2 minor issues on Windows

2022-03-13 Thread Marco Bodrato
Ciao, Il 2022-03-13 00:06 Torbjörn Granlund ha scritto: There is some sort of sick competition between certain compilers to have the most warnings for valid C. I don't think we should play their game, Incidantally, arithmetic on unsigned types is well-defined. Unlike that of signed type

Re: unused macro MPN_PTR_SWAP in mini-gmp.c

2022-03-17 Thread Marco Bodrato
Ciao Paul, Il 2022-03-09 02:56 Paul Eggert ha scritto: In libgmp 6.2.1, mini-gmp.c defines a macro without using it, causing Thanks for spotting this! Proposed patch attached. There is also a different possible way to heal the problem: using it :-D diff -r a44f487c8d20 mini-gmp/mini-gmp.c

Re: unused macro MPN_PTR_SWAP in mini-gmp.c

2022-03-20 Thread Marco Bodrato
Ciao Paul, Il 2022-03-18 00:37 Paul Eggert ha scritto: On 3/17/22 11:32, Marco Bodrato wrote: -  MP_SIZE_T_SWAP (u->_mp_alloc, v->_mp_alloc); -  MP_PTR_SWAP (u->_mp_d, v->_mp_d); +  MPN_PTR_SWAP (u->_mp_d, u->_mp_alloc, v->_mp_d, v->_mp_alloc); Thank you, this looks

Re: Can't install on Kali linux

2022-04-15 Thread Marco Bodrato
Ciao, I agree with the message by Niels. But I add a comment. Il 2022-04-14 21:59 Adham Khalile Yousef ha scritto: My purpose of install gmp is to be able to"# include " in other C programs on my machine (i.e., same linux, I even tried to give If your purpose is simply to use the library, an

Re: make check fails; fedora core 37 (x86_64)

2022-04-16 Thread Marco Bodrato
Ciao George, Il 2022-04-08 18:16 George R Goffe ha scritto: I'm having a bit of trouble building gmp from the source repository at:. Here's what make check "tells me". I probably did something wrong but, for the life of me, can't see it. Here's a snip from the full build (included). You attach

Re: clang warning about mini-gmp.c when used in Emacs

2022-04-19 Thread Marco Bodrato
Ciao, Il Lun, 18 Aprile 2022 9:38 am, Paul Eggert ha scritto: > mini-gmp.c is different from gmp-impl.h, because it's intended to be > used by lots of downstream projects which may use compilers that > gmp-impl.h does not use. This may help to explain why it needs casts > that gmp-impl.h doesn't n

Re: mini-gmp mpz_powm incorrect result

2022-09-29 Thread Marco Bodrato
Ciao, Il 2022-08-30 10:25 Vincent Lefevre ha scritto: or even (mn == 0 check just above this code rules out |m| < 1) mpz_set_ui (r, mpz_cmpabs_ui (m, 1)); I agree with this solution. Will you commit it? Concerning this second solution, the GMP manual says: -- Function: int mpz_cmpabs_u

Re: mini-gmp mpz_powm incorrect result

2022-09-29 Thread Marco Bodrato
Il 2022-09-05 19:04 Marco Bodrato ha scritto: Il 2022-08-30 10:25 Vincent Lefevre ha scritto: or even (mn == 0 check just above this code rules out |m| < 1) mpz_set_ui (r, mpz_cmpabs_ui (m, 1)); I agree with this solution. Will you commit it? I incorrectly removed the "Niel

Re: mini-gmp mpz_powm incorrect result

2022-09-29 Thread Marco Bodrato
Ciao, Il 2022-09-05 21:23 ni...@lysator.liu.se ha scritto: Marco Bodrato writes: I propose to also add a couple of tests to mini-gmp/tests/t-powm.c , to keep track of this. Definitely needed, thanks for looking into that. + if (mpz_cmp_ui (res, 1) <= 0) +mpz_add_ui (res, res

Re: Reporting a gmp bug

2022-10-28 Thread Marco Bodrato
Ciao, Il 2022-10-26 13:40 ni...@lysator.liu.se ha scritto: jy l writes: It seems like in `mpz_nextprime` this line ( https://gmplib.org/repo/gmp/file/tip/mpz/nextprime.c#l204), when `n` is very large, it doesn't restrict the value of `odds_in_composite_sieve` which leads to the `alloca` bel

Re: Side-channel leakage in the mpz_powm_sec interface

2023-08-25 Thread marco . bodrato
Ciao, 25 ago 2023, 08:11 da ni...@lysator.liu.se: > Niels Möller writes: > >> It's preferable to use the mpn_powm_sec. When using mpz_t, I see no >> reasonable to avoid leakage of the normalized size (or number of >> all-zero limbs at the most significant end). >> > One possibly unreasonable app

Re: Uninitialized memory bug found in /mpn/generic/mod_1_1.c

2023-08-31 Thread marco . bodrato
Ciao, 31 ago 2023, 16:30 da ku...@shaw.ca: > 1) Edit line 248 mpn/generic/mp_limb_t pre[4]; into: > ~/src/gmp$ hg diff mpn/generic/ diff -r 3ac5afa36be5 mpn/generic/mod_1.c --- a/mpn/generic/mod_1.c   Wed Nov 02 13:48:37 2022 +0100 +++ b/mpn/generic/mod_1.c   Thu Aug 31 16:46:35 2023 +020

Re: Uninitialized memory bug found in /mpn/generic/mod_1_1.c

2023-08-31 Thread marco . bodrato
Ciao, 31 ago 2023, 18:06 da vinc...@vinc17.net: > I don't think that this is sufficient for the test. > The code Brett mentioned is for MOD_1_1P_METHOD = 2. > The code Brett mentioned is mixed, I fear. Looking at mpn/generic/mod_1_1.c,if MOD_1_1P_METHOD == 1, the value[2] in the array is always

Re: Unsigned integer overflow in `toom_eval_pm2.c`

2023-09-03 Thread marco . bodrato
Ciao, 3 set 2023, 22:16 da ni...@lysator.liu.se: > Andrew Teylu writes: > > I see no good reason to involve any signed values here, though. Maybe > the variable neg, and the return value, should be changed to mp_limb_t, > or at least unsigned int? > Yes, unsigned is the best choice, it used t

Re: Unsigned integer overflow in `toom_eval_pm2.c`

2023-09-04 Thread marco . bodrato
Ciao, 4 set 2023, 08:02 da ni...@lysator.liu.se: > As Vincent suggested, it would be good to document somewhere what the > convention is (values 0 or ~0). > Would a comment "It returns 0 or ~0, depending on the sign of the result" added to all the mpn_toom_eval_ functions suffice? > And maybe

Re: Unsigned integer overflow in `toom_eval_pm2.c`

2023-09-05 Thread marco . bodrato
Ciao, 4 set 2023, 15:19 da vinc...@vinc17.net: > On 2023-09-04 09:52:23 +0200, marco.bodr...@tutanota.com wrote: > >> Should the value ~0 be written as ~0U to be correctly assigned to an >> unsigned? >> > > IMHO, this would be better as this would make the signedness of > the types more consisten

Re: major formatted output function bug with %c and the value 0

2023-12-13 Thread marco . bodrato
Ciao, 13 dic 2023, 15:53 da vinc...@vinc17.net: > On 2023-12-03 20:19:10 +0100, Vincent Lefevre wrote: > >> With GMP 6.3.0, the formatted output functions do not handle %c >> with the value 0 correctly. For gmp_sprintf, the return value is >> incorrect. >> > In printf/sprintffuns.c, function gmp_

Re: mini-gmp mpz_gcdext Bézout coefficients do not match documentation

2024-02-17 Thread marco . bodrato
Ciao Niels, 17 feb 2024, 17:53 da ni...@lysator.liu.se: > Niels Möller writes: > The documented conditions say that gmp should return the same cofactors > The documentation also says "If abs(a) = abs(b), then s = 0, t = sgn(b)." > > canonicalization logic at the end wasn't right. Appending a

Re: mini-gmp mpz_gcdext Bézout coefficients do not match documentation

2024-02-17 Thread marco . bodrato
Ciao, 17 feb 2024, 19:15 da : > Ciao Niels, > > 17 feb 2024, 17:53 da ni...@lysator.liu.se: > >> Niels Möller writes: >> The documented conditions say that gmp should return the same cofactors >> > > The documentation also says "If abs(a) = abs(b), then s = 0, t = sgn(b)." > Maybe we should also

Re: mini-gmp mpz_gcdext Bézout coefficients do not match documentation

2024-02-17 Thread marco . bodrato
Ciao Niels, 17 feb 2024, 21:26 da ni...@lysator.liu.se: > marco.bodr...@tutanota.com writes: > >> Maybe we should also add the test: >> >>   /* Require that s==0 iff g==abs(b) */ >>   if (!mpz_sgn (s) ^ !mpz_cmpabs (g, b)) >>   goto fail; >> > > Good point, that's better than only checking th

Re: mini-gmp mpz_gcdext Bézout coefficients do not match documentation

2024-02-18 Thread marco . bodrato
Ciao Niels, 18 feb 2024, 10:10 da ni...@lysator.liu.se: > marco.bodr...@tutanota.com writes: > >> What about; >> >> >> /* Arrange so that |s| < |u| / 2g */ >>   mpz_add (s1, s0, s1); >>   { >>     int cmp = mpz_cmpabs (s0, s1); >>     if (cmp >= 0) >>   { >>     mpz_swap (s0, s1); >>

Re: major formatted output function bug with %c and the value 0

2024-02-18 Thread marco . bodrato
Ciao Vincent, 15 dic 2023, 13:26 da vinc...@vinc17.net: > Note that there are similar issues in printf/repl-vsnprintf.c, and I > I finally had the time to examine the code and test it. I attach a proposed patch. I changed the 3 files: printf/doprntf.c, printf/repl-vsnprintf.c, printf/sprintff

Re: major formatted output function bug with %c and the value 0

2024-03-25 Thread marco . bodrato
Ciao, 18 feb 2024, 12:29 da marco.bodr...@tutanota.com: > 15 dic 2023, 13:26 da vinc...@vinc17.net: > >> Note that there are similar issues in printf/repl-vsnprintf.c, and I >> > > I finally had the time to examine the code and test it. I attach a proposed > patch. > Vincent, you did not confirm

Re: Inconsistent definitions of millerrabin() argument types

2024-03-25 Thread marco . bodrato
Ciao, 24 mar 2024, 10:59 da cas...@gmail.com: > Hi, > > In millerrabin.c, there are conflicting definitions for millerrabin(). > > The prototype is: > I removed the prototype, by swapping the function order :-) Thanks. m ___ gmp-bugs mailing list gmp-bu

  1   2   >