Segfault in mpn_toom42_mul with small unbalanced inputs (e.g., 9x5) when MUL_TOOM22_THRESHOLD is low

marco.bodrato at tutanota.com marco.bodrato at tutanota.com
Mon Feb 16 13:48:39 CET 2026


Ciao,

16 feb 2026, 12:31 da tg at gmplib.org:

> marco.bodrato at tutanota.com writes:
>
>  Should we add lines like the following in all toom*.c functions?ASSERT( MUL_TOOM22_THRESHOLD >= MPN_TOOM22_MUL_MINSIZE); 
>
> That would add overhead for a fat binary, IIRC.
>
> So a NONFAT_ASSERTis needed. :-)
>
Uhm, maybe there is a risk to add overhead to the tuning process too?

We may write a new tests/t-thresholds.c, so that anyone playing with constants that should be tuned will see a clear failure in the tests.

Ĝis,
mb


More information about the gmp-bugs mailing list