unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mikael Djurfeldt <djurfeldt@nada.kth.se>
Cc: djurfeldt@nada.kth.se
Subject: Re: GMP code committed -- watch for bugs.
Date: Sun, 06 Apr 2003 11:16:44 +0200	[thread overview]
Message-ID: <xy7of3kkmtf.fsf@nada.kth.se> (raw)
In-Reply-To: <xy7u1dclij6.fsf@nada.kth.se> (Mikael Djurfeldt's message of "Sat, 05 Apr 2003 23:51:41 +0200")

Mikael Djurfeldt <djurfeldt@nada.kth.se> 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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  parent reply	other threads:[~2003-04-06  9:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-04 22:34 GMP code committed -- watch for bugs Rob Browning
2003-04-05 12:24 ` Marius Vollmer
2003-04-05 21:51 ` Mikael Djurfeldt
2003-04-05 22:26   ` Rob Browning
2003-04-06  7:41     ` Mikael Djurfeldt
2003-04-06  9:16   ` Mikael Djurfeldt [this message]
2003-04-06 18:43     ` Rob Browning
2003-04-06 19:12       ` Mikael Djurfeldt
2003-04-06 20:09         ` Rob Browning
2003-04-06 20:25     ` Rob Browning
2003-04-06  9:23 ` Mikael Djurfeldt
2003-04-06 20:15   ` Rob Browning
2003-04-06 22:50 ` Kevin Ryde
2003-05-10  0:22   ` GMP code committed -- watch for bugs ... gcd n 0 Kevin Ryde
2003-04-23 22:40 ` GMP code committed -- watch for bugs Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xy7of3kkmtf.fsf@nada.kth.se \
    --to=djurfeldt@nada.kth.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).