mersenneforum.org (https://www.mersenneforum.org/index.php)
-   GMP-ECM (https://www.mersenneforum.org/forumdisplay.php?f=55)
-   -   GMP-ECM with gwnum failure (https://www.mersenneforum.org/showthread.php?t=25559)

 mathwiz 2020-05-20 20:03

GMP-ECM with gwnum failure

Got this failure today. I cannot tell if this is a bug in GMP-ECM or GWNUM, or some combination?

[CODE]\$ echo "(7^2048+1)/4119427741479153633869060968771666377359362" | ./ecm -v -c 100 11e7
GMP-ECM 7.0.4 [configured with GMP 6.2.0, GWNUM 29.8, --enable-asm-redc] [ECM]
Tuned for x86_64/k8/params.h
Due to incompatible licenses, this binary file must not be distributed.
Input number is (7^2048+1)/4119427741479153633869060968771666377359362 (1689 digits)
Found number: 1*7^2048 + 1
Using mpz_mod
Using B1=110000000, B2=900514153782, polynomial Dickson(30), sigma=0:16110665023593047747
dF=199680, k=2, d=2081310, d2=13, i0=40
Expected number of curves to find a factor of n digits:
35 40 45 50 55 60 65 70 75 80
34 133 600 3065 17462 108584 733594 5340128 4.2e+07 3.5e+08
Using gwnum_ecmStage1(1, 7, 2048, 1, 110000000, 1)
ecm: Fgw.c:399: gw_ecm_stage1: Assertion `siz_x <= (unsigned long) ((gw_x)->_mp_alloc)' failed.
Aborted[/CODE]

 Prime95 2020-05-20 20:43

I believe the bug is in Fgw.c

The lines:[CODE] mpz_init2 (gw_x, (gw_n+1)*gw_log_2(gw_b)+64);
mpz_init2 (gw_z, (gw_n+1)*gw_log_2(gw_b)+64);
[/CODE] are not allocating enough space.

This is an overkill solution:

[CODE] mpz_init2 (gw_x, (gw_n+1)*(gw_log_2(gw_b)+1)+64);
mpz_init2 (gw_z, (gw_n+1)*(gw_log_2(gw_b)+1)+64);
[/CODE]

A proper solution would use floats to calculate gw_log_2

 mathwiz 2020-05-20 22:37

[QUOTE=Prime95;546027]I believe the bug is in Fgw.c

The lines:[CODE] mpz_init2 (gw_x, (gw_n+1)*gw_log_2(gw_b)+64);
mpz_init2 (gw_z, (gw_n+1)*gw_log_2(gw_b)+64);
[/CODE] are not allocating enough space.

This is an overkill solution:

[CODE] mpz_init2 (gw_x, (gw_n+1)*(gw_log_2(gw_b)+1)+64);
mpz_init2 (gw_z, (gw_n+1)*(gw_log_2(gw_b)+1)+64);
[/CODE]

A proper solution would use floats to calculate gw_log_2[/QUOTE]

Wow! Amazing how quickly you tracked that down. Thanks for your help.

The fix does seem to be working locally. I don't know if the GMP-ECM developers monitor this forum; perhaps they should be made aware of the proposed fix?

 Prime95 2020-05-21 09:49

The developers report the problem is fixed in revision 3084

 All times are UTC. The time now is 09:40.