[GiNaC-devel] chinese_remainder() bug versus x86_64 (Was: Univariate GCD benchmark)

Richard B. Kreckel kreckel at ginac.de
Mon Feb 9 20:22:47 CET 2009


Dear Alexei,

Alexei Sheplyakov wrote:
>> I've got another theory. There was a bug in chinese_remainder() function.
>> It's easy to spot it on 32-bit architecture, but not on 64-bit one. If my
>> theory is correct, the patch below should trigger the bug on 64-bit
>> architecture. Could you please try it (WITHOUT applying a patch which is
>> supposed to fix the bug, of course)?
>>
>>
>> Note: this patch is not supposed to be applied to the `official' repository.
>>
>> diff --git a/ginac/polynomial/primes_factory.h b/ginac/polynomial/primes_factory.h
>> index 093c973..d80bff7 100644
>> --- a/ginac/polynomial/primes_factory.h
>> +++ b/ginac/polynomial/primes_factory.h
>> @@ -25,7 +25,7 @@ private:
>>         cln::cl_I last;
>>         // This ensures coefficients are immediate.
>>         static const int immediate_bits = 8*sizeof(void *) - __alignof__(void *);
>> -       static const long opt_hint = (1L << (immediate_bits >> 1)) - 1;
>> +       static const long opt_hint = (1L << 14) - 1L;
>>  public:
>>         primes_factory()
>>         {
> 
> Any feedback? I'm sorry for hurrying you, but this issue needs to be clarified
> before the release.

Oh, that patch above triggers the bug on 64-bit architectures, too! (I 
already emailed you off-list about this on Sunday.)

For the record, here's what I did:
$ git checkout master~9
This left me with "HEAD is now at 45b1e47... Implement modular 
multivariate GCD (based on chinese remaindering algorithm)." I applied 
you "patch", made check and it hang at the same point that has been 
reported before by Jens and Vladimir on 32-bit systems.

regards
    -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>


More information about the GiNaC-devel mailing list