[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-glpk] exact solver broken on 64-bit platforms when using intern
From: |
Andrew Makhorin |
Subject: |
Re: [Bug-glpk] exact solver broken on 64-bit platforms when using internal mp library |
Date: |
Thu, 20 Mar 2008 15:45:36 +0300 |
> 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