Re: int8 bug on Alpha

From: Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>
To: lockhart(at)fourpalms(dot)org
Cc: Postgresql <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: int8 bug on Alpha
Date: 2001-03-21 16:29:30
Message-ID: 3AB8D6EA.B6DB7E32@albourne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Anyway, either strtol() thinks it *should* be able to read a 64 bit
> integer, or your machine is silently overflowing. I used to have a bunch
> of these boxes, and I recall spending quite a bit of time discovering
> that Alphas have some explicit flags which can be set at compile time
> which affect run-time detection of floating point and (perhaps) integer
> overflow behavior.
>
> Can you check these possibilities? I'd look at strtol() first, then the
> overflow/underflow flags second...

Hmm, I wrote a trivial programme parsing long ints and get the following

#include <errno.h>

main (int argc, char *argv[]) {
long int a = strtol(argv[1], (char **) 0, 10);
printf("input='%s' ld=%ld (errno %d)\n",argv[1],a,errno);
}

emily:~/Tmp/C++$ a.out 9223372036854775807
input='9223372036854775807' ld=9223372036854775807 (errno 0)
emily:~/Tmp/C++$ a.out 9223372036854775808
input='9223372036854775808' ld=9223372036854775807 (errno 34)
emily:~/Tmp/C++$ a.out 9223372036854775806
input='9223372036854775806' ld=9223372036854775806 (errno 0)
emily:~/Tmp/C++$ a.out -9223372036854775808
input='-9223372036854775808' ld=-9223372036854775808 (errno 0)

so that seems to work correctly. And I compiled with the same compiler
flags with which postgres was compiled. Apparently long is defined as
'long long int' on alpha, and I tried it with that and it works as well.

I'll have to debug this properly, but first I need to get Friday out of
the way ;-)

Adriaan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Roberto Mello 2001-03-21 16:34:40 Re: [HACKERS] Patch application
Previous Message Thomas Lockhart 2001-03-21 16:02:06 Re: RPM building (was regression on RedHat)