![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
As bug #1679 is more than 6 months old, I'd like to get a status. If it can help, I confirm that, without modifications, the current stable release of PostgreSQL does not compile on HP-UX 11.11. |
#3
| |||
| |||
|
|
When configure checks to see if we have finite(), it attempts to compile a small program containing 'dummy=finite(1.0)'. On my system, where I am using gcc 4.0.2, this small program is tested with a '-O2' flag, and the gcc optimizer is too smart ! It detects that we are writing to a dummy var, and it removes the line ! |
#4
| |||
| |||
|
|
In order for the check to be done correctly, we have to provide a program that the compiler cannot optimize, ie where it cannot detect that the call is useless, even if it is very very smart. Here is a patch with such a program. |
#5
| |||
| |||
|
|
"F. Laupretre" <flconseil (AT) yahoo (DOT) fr> writes: In order for the check to be done correctly, we have to provide a program that the compiler cannot optimize, ie where it cannot detect that the call is useless, even if it is very very smart. Here is a patch with such a program. I haven't got a lot of faith in your proposed patch --- with sufficiently aggressive optimization, the compiler might inline the is_f() function, no? After looking at the modern version of AC_CHECK_FUNC, I'm thinking that the best answer is to make the finite() result affect the program's exit status. Would you try this version of the check and see if it works for you? AC_TRY_LINK([#include <math.h>], [return finite(1.0) ? 0 : 1;], [AC_DEFINE(HAVE_FINITE, 1, [Define to 1 if you have finite().]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) |
#6
| |||
| |||
|
|
Could any other configure tests fail in this way? |
#7
| |||
| |||
|
|
Or maybe, if it is really too smart (able to compute the result at compile time), we could have not to use a constant argument. Something like 'return finite((double)argv) ? 0 : 1'. |
#8
| |||
| |||
|
|
I suppose though that there's some chance of the constant-argument case being treated differently from not-constant, so your idea has some merit. |
#9
| |||
| |||
|
|
Am Mittwoch, 11. Januar 2006 22:33 schrieb Tom Lane: I suppose though that there's some chance of the constant-argument case being treated differently from not-constant, so your idea has some merit. Use a global rather than a local variable. |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |