AW: AW: Could turn on -O2 in AIX - Mailing list pgsql-hackers

From Zeugswetter Andreas SB
Subject AW: AW: Could turn on -O2 in AIX
Date
Msg-id 11C1E6749A55D411A9670001FA687963368109@sdexcsrv1.f000.d0188.sd.spardat.at
Whole thread Raw
Responses Re: AW: AW: Could turn on -O2 in AIX  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> There is a special case in nabstime.h for AIX, which imho
> got swapped. The normal case for me would be INT_MIN
> and not the 0x80000001.
> There is a comment that I don't understand at all given the below 
> source code:
> 
> /*
>  * AIX considers 2147483648 == -2147483648 (since they have 
> the same bit
>  * representation) but uses a different sign sense in a comparison to
>  * these integer constants depending on whether the constant is signed
>  * or not!
>  */
> #if defined (_AIX)
> #define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN)
> #else 
> #define NOSTART_ABSTIME ((AbsoluteTime) 0x80000001)           
>   /* -2147483647 (- 2^31) */
> #endif
> 
> But that is unfortunately not the problem. Looks like yet 
> another broken compiler to me :-(

Ok, the comparison ((int) time) > ((int) 0x80000001) is the problem.
Reading the comment again and again, I have come to the conclusion,
that the intent was originally to avoid INT_MIN on AIX.

My solution would be to use INT_MIN for all ports, which has the advantage 
that the above problematic comparison can be converted to !=,
since no integer will be smaller than INT_MIN.

Please apply the patch and all works well.

Thanks
Andreas


pgsql-hackers by date:

Previous
From: "Martin A. Marques"
Date:
Subject: Postgres article
Next
From: Peter Eisentraut
Date:
Subject: Re: Problems with Perl