Open josepguardia opened 2 years ago
I confirmed size_s1
is 0
:
size_s1 = mpn_get_str (str1, b, r + i0, n - i0);
There are 1 errors and 1 warnings:
1>f:\vcpkg\installed\x64-windows\include\gmp.h(1795): warning C4244: 'return': conversion from 'mp_limb_t' to 'unsigned long', possible loss of data
1>f:\vcpkg\installed\x64-windows\include\gmp.h(2240): error C4146: unary minus operator applied to unsigned type, result still unsigned
After some debugging, the different between debug and release is mpn_lshift(a, 0 + 2, 2, 1)
returned different values 18446744073618895986
(debug) and 13107199999806695700
(release) in src/getstr.c line 2800.
I have less knowledge with mpfr and gmp, can you send this to the upstream?
Thanks.
with mpfr 4.1.0 under x86_64 Linux, if I add the following lines around the mpn_lshift command at line 2800:
gmp_printf ("nx1=%lu n=%lu result+nx1=%Nd\n", nx1, n, result + nx1, n);
mp_limb_t ret;
ret = mpn_lshift (a, result + nx1, n , 1);
gmp_printf ("ret=%lu a=%Nd\n", ret, a, n);
I get:
nx1=2 n=2 result+nx1=120892581961462917470617599999954672185
ret=0 a=241785163922925834941235199999909344370
The value a has two limbs, the least significant is 18446744073618895986 and the most significant is 13107199999999999999.
As it is commented here:
https://sympa.inria.fr/sympa/arc/mpfr/2021-12/msg00007.html
Maybe the solution could be changing the dependency of MPFR from GMP to MPIR.
@josepguardia That's avoid this issue, not fix this issue. The question is why the debug version is correct but release version has this issue.
The question is why the debug version is correct but release version has this issue.
Maybe an optimization bug in the compiler (this would not be the first time that an optimization bug affects MPFR). You could try to rebuild with and without optimizations, and compare.
This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.
does the bug still appear with newer versions of vcpkg?
This OPEN issue is from 2021! Unbelievable! This is what I get on Windows 11 x64:
thus the issue seems to be fixed in vcpkg?
@FrankXie05 Please validate this with latest code again.
Results in the latest vcpkg:
This OPEN issue is from 2021!
After installing mpfr it doesn't seem to work well.
This simple program:
I build it:
And I get:
But using Debug libraries it works well...
I also asked to mpfr distribution group... but it seems more related to vcpkg to me. It works well in linux and macos.
https://sympa.inria.fr/sympa/arc/mpfr/2021-12/
Do you know what is happening?
Thanks!