[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A couple of bugs
From: |
Dean Clamons |
Subject: |
A couple of bugs |
Date: |
Wed, 21 Aug 2002 15:25:55 -0400 |
1. gmp won't quite build correctly on my HP system. Here are the details about
my system:
GMP version: 4.1
Configuration options: CC=cc
Compiler: cc
Compiler Version: cpp: HP92453-01 A.10.32.03 HP C Preprocessor
ccom: HP92453-01 G.10.32.05 HP C Compiler
uname -a: HP-UX null B.10.20 A 9000/898 1657613331 two-user license
.config.guess: hppa2.0-hp-hpux10.20
./configfsf.guess: hppa2.0-hp-hpux10.20
The problem is manifested in the message:
Make: Don't know how to make SCANF_OBJECTS. Stop.
The reason for the problem is that the HP make doesn't deal with the line
immediately preceding the definition of SCANF_OBJECTS in the Makefile. That
line end with \ (a backslash) with nothing on the following line. Apparently
this version of make does not like a blank continuation line. It was easy for
me to fix the problem by just removing the trailing backslash. The more general
solution involves the Makefile.in file, and I did not pursue the problem that
far.
2. This compiler handles 'long long' types, but the configure file will not let
it be used. I'm not sure why. I see that it checks the version of the compiler
rather than doing an actual check of 'long long's. Is there some kind of known
problem with this version of the compiler?
3. There is a bug in the test routine t-sizeinbase in tests/mpz.
The problem is that in routine mpz_fake_bits there is the line:
PTR(z) = (&n) - (SIZ(n)-1);
That's not legal since it points to unallocated space. I suggest the following
instead:
--------------------------------------------------------
/* Create a fake mpz consisting of just a single 1 bit, with totbits being
the total number of bits, inclusive of that 1 bit. */
void
mpz_fake_bits (mpz_ptr z, unsigned long totbits)
{
static mp_limb_t n;
unsigned long zero_bits, zero_limbs;
zero_bits = totbits - 1;
zero_limbs = zero_bits / GMP_NUMB_BITS;
zero_bits %= GMP_NUMB_BITS;
SIZ(z) = zero_limbs + 1;
z->_mp_d[SIZ(z) - 1] = CNST_LIMB(1) << zero_bits;
ASSERT_ALWAYS (mpz_sizeinbase (z, 2) == totbits);
}
/* This was seen to fail on a GNU/Linux powerpc32 with gcc 2.95.2,
apparently due to a doubtful value of mp_bases[10].chars_per_bit_exactly
(0X1.34413509F79FDP-2 whereas 0X1.34413509F79FFP-2 is believed correct).
Presumably this is a glibc problem when gcc converts the decimal string
in mp_bases.c, or maybe it's only a function of the rounding mode during
compilation. */
void
check_sample (void)
{
unsigned long totbits = 198096465;
int base = 10;
size_t want = 59632979;
size_t got;
mpz_t z;
mpz_init2( z, totbits );
mpz_fake_bits (z, totbits);
got = mpz_sizeinbase (z, base);
if (got != want)
{
printf ("mpz_sizeinbase\n");
printf (" base %d\n", base);
printf (" totbits %lu\n", totbits);
printf (" got %u\n", got);
printf (" want %u\n", want);
abort ();
}
mpz_clear( z );
}
-------------------------------------------------
Thanks very much,
Dean Clamons
Code 7420
Naval Research Lab
Washington, DC 20375
202-767-2732
- A couple of bugs,
Dean Clamons <=