mpz_mul memory allocation bug
Torbjörn Granlund
tg at gmplib.org
Thu Jun 25 10:32:18 UTC 2015
Daniel Kochmański <dkochmanski at turtle-solutions.eu> writes:
I've encontered problem with GMP 6.0.0 when used with ECL (Embeddable
Common-Lisp). Memory is managed by bdwgc and gmp seems to allocate
memory somewhere, where it shouldn't, resulting in:
(SIGABRT) "Duplicate large block deallocation"
OK. so GMP allocates memory where it shouldn't (whatever that means) and
a LISP system as a result deallocates a memory area twice... Your line
of reasoning is not crystal clear. :-)
Problem is absent in GMP 4.2.1. After tracking problem, I've came to
conclusion, that it is caused by `mpn_fft_mul', which is called by
`mpn_sqr', being optimization for corner-case, when `mpz_mul' is called
with the same bignum as second and third argument.
Removing optimization "fixes" problem. `mpn_fft_mul' is called, when
size n isn't below `SQR_FFT_THRESHOLD', and comment:
/* The current FFT code allocates its own space. That should probably
change. */
might be a clue, that this is a place of problem.
This comment does not say that we knowingly do something that is buggy.
It is rather a suggestion for a code cleanup.
If you have a self-contained tests case for GMP where it misbehaves,
please report it to us.
You present report is nothing we can work with, I'm afraid.
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-bugs
mailing list