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
diff --git a/src/makefiles/Makefile.hpux b/src/makefiles/Makefile.hpux
index 1917d61..f2a8f19 100644
--- a/src/makefiles/Makefile.hpux
+++ b/src/makefiles/Makefile.hpux
@@ -43,6 +43,12 @@ else
    CFLAGS_SL = +Z
 endif
 
+
+# HP-UX libm functions on 'Integrity server' do not set errno by default,
+# for errno setting, compile with the +Olibmerrno option.
+
+CFLAGS := +Olibmerrno $(CFLAGS)
+
 # Rule for building a shared library from a single .o file
 %$(DLSUFFIX): %.o
 ifeq ($(GCC), yes)
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to