Re: int8 bug on Alpha - Mailing list pgsql-hackers

From Adriaan Joubert
Subject Re: int8 bug on Alpha
Date
Msg-id 3AB8D6EA.B6DB7E32@albourne.com
Whole thread Raw
In response to int8 bug on Alpha  (Adriaan Joubert <a.joubert@albourne.com>)
List 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


pgsql-hackers by date:

Previous
From: Roberto Mello
Date:
Subject: Re: Patch application
Next
From: Bruce Momjian
Date:
Subject: Re: Patch application