Thread

  1. Re: int8 bug on Alpha

    Adriaan Joubert <a.joubert@albourne.com> — 2001-03-21T16:29:30Z

    > 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