"errno" not set in case of "libm" functions (HPUX) - Mailing list pgsql-hackers

From Ibrar Ahmed
Subject "errno" not set in case of "libm" functions (HPUX)
Date
Msg-id BANLkTim+7GH5W7MWMMFqdBFa4RFG+S06uQ@mail.gmail.com
Whole thread Raw
Responses Re: "errno" not set in case of "libm" functions (HPUX)  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Domains versus polymorphic functions, redux
Next
From: Tom Lane
Date:
Subject: Re: Domains versus polymorphic functions, redux