[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GMP code committed -- watch for bugs.
From: |
Mikael Djurfeldt |
Subject: |
Re: GMP code committed -- watch for bugs. |
Date: |
Sun, 06 Apr 2003 11:16:44 +0200 |
User-agent: |
Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux) |
Mikael Djurfeldt <address@hidden> writes:
> 2. My first attempt to build Guile has failed. check_sanity aborts at
> the long_long LLONG_MAX test. Unfortunately, I can't look into
> that right now.
OK. There seems to be two bugs preventing the long_long tests from
succeeding:
1. num2integral.i.c:INTEGRAL2BIG had a bug in computing the absolute
value of n when preparing arguments to mpz_import. I've committed
a fix for this.
2. The determination of required storage size for a bignum is buggy:
ITYPE
NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
{
[...]
numbits = mpz_sizeinbase (SCM_I_BIG_MPZ (num), 2);
if (UNSIGNED) numbits++;
scm_remember_upto_here_1 (num);
if (numbits > (sizeof (ITYPE) * 8))
scm_out_of_range (s_caller, num);
Firstly, you probably intended to write "if (!UNSIGNED)" (to make room
for the sign bit). Secondly, that doesn't work either. For example,
the absolute value of LLONG_MIN requires 64 bits, even though it is a
signed number. So, regardless if we have "if (UNSIGNED)" or "if
(!UNSIGNED)" there will always be a case where a valid long_long or
ulong_long will cause an out_of_range error.
Unfortunately, I don't have time to get enough overview of the
situation to fix this bug. I'll leave that to you.
Best regards,
Mikael
Re: GMP code committed -- watch for bugs., Mikael Djurfeldt, 2003/04/06
Re: GMP code committed -- watch for bugs., Kevin Ryde, 2003/04/06
Re: GMP code committed -- watch for bugs., Kevin Ryde, 2003/04/23