[HACKERS] random_fract and aix compiler bug

From: "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: <pgsql-patches(at)postgresql(dot)org>
Subject: [HACKERS] random_fract and aix compiler bug
Date: 2003-10-17 15:26:46
Message-ID: 46C15C39FEB2C44BA555E356FBCD6FA40184CED7@m0114.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Hi Peter,

While fighting with a compiler bug here, I came across the following code,
that loops here (on AIX 4.3.2) due to a compiler bug,
presumably with the z < MAX_RANDOM_VALUE (it even warns at compile time):

static double
random_fract(void)
{
long z;

/* random() can produce endpoint values, try again if so */
do
{
z = random();
} while (!(z > 0 && z < MAX_RANDOM_VALUE));
return (double) z / (double) MAX_RANDOM_VALUE;
}

Since you where the last to commit on analyze.c I send you this mail,
since my mails currently don't pass some filter on postgresql.org

I have attached a patch as a workaround for this silly compiler bug.
Please consider to apply, Thanks

Andreas

Attachment Content-Type Size
analyze.patch application/octet-stream 568 bytes

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-10-17 17:17:40 Re: [HACKERS] random_fract and aix compiler bug
Previous Message Gaetano Mendola 2003-10-17 09:16:38 Re: minor HISTORY improvement