> in glpk 4.25, the pool allocator fails in src/glpgmp.c:46 since

> sizeof(struct mpq) <= sizeof(struct mpz_seg)

> does not hold on a LP-64 platform. The compiler inserts padding in front
> of the pointers such that sizeof(struct mpq)=32 and sizeof(struct
> mpz_seg)=24. Changing 'unsigend short d[6]' to 'unsigned short d[12]' in
> in struct mpz_seg in include/glpgmp.h is a workaround, but the proper
> fix is probably to use max(sizeof(struct mpq),sizeof(struct mpz_seg)) as
> an argument to all pool-allocation functions.

Thank you for the bug report.

In fact, glpk implementation of bignums was optimized for 32-bit
platforms (assuming that all structs are of 16 bytes long).
However, since that time the pool routines were re-implemented and
now the same memory pool can be used for structs of different size.

The correct way to fix the bug is a bit more complex, namely, each
call to dmp_get_atom and dmp_free_atom should be provided with the
corresponding struct size.

I hope to make necessary changes the code in a next release of the
package.


Andrew Makhorin



_______________________________________________
Bug-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-glpk

Reply via email to