"errno" not set in case of "libm" functions (HPUX)

From: Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: "errno" not set in case of "libm" functions (HPUX)
Date: 2011-05-24 17:21:42
Message-ID: BANLkTim+7GH5W7MWMMFqdBFa4RFG+S06uQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have found a problem which is specifically related to "HP-UX" compiler.
All 'libm' functions on "HP-UX Integrity server" do not set "errno" by
default. For 'errno' setting we should compile the code using +Olibmerrno
option. So we should add this option in "/src/makefiles/Makefile.hpux".
Otherwise we cannot expect this code to work properly

[float.c]
Datum
dacos(PG_FUNCTION_ARGS)
{
...
errno = 0;
result = acos(arg1);
if (errno != 0)
ereport(ERROR,

(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("input is out of range")));

...
}

Because "acos" function will not set the errono in case of invalid input, so
check will not trigger the error message. I have attached a patch to add
this option in HPUX makefile.

BTW I have found same kind of discussion without any conclusion here

http://archives.postgresql.org/pgsql-hackers/2011-05/msg00046.php

--
Ibrar Ahmed

Attachment Content-Type Size
hpux_Olibmerrno_ibrar1.patch text/x-diff 492 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-05-24 17:28:38 Re: Domains versus polymorphic functions, redux
Previous Message Tom Lane 2011-05-24 17:13:41 Re: Domains versus polymorphic functions, redux