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 %

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

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 correlation

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);

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

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" <bodr...@mail.dm.unipi.it> 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

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: Likely GMP bug

2018-05-30 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-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

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

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 >&g

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: 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

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 >

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

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: 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

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

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

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: 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: 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

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

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.

Re: Make check fails on samsung S8 (2)

2020-10-29 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...

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

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: 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:

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

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

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 ___

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 overflows

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 « 

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"

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

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?

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

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...

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

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

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: 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: 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

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/ ,

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,

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

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

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

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

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,

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

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

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

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

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: 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

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

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

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`

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

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: 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

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

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,

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

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

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

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