Re: BUG #2162: Same as bug #1679 - finite() - unresolved symbol
От | F. Laupretre |
---|---|
Тема | Re: BUG #2162: Same as bug #1679 - finite() - unresolved symbol |
Дата | |
Msg-id | ADECLLACEIPMLMCPIGGAKEACCCAA.flconseil@yahoo.fr обсуждение исходный текст |
Ответ на | Re: BUG #2162: Same as bug #1679 - finite() - unresolved symbol (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-bugs |
Thanks for your suggestion. It could have been the include files but I reco= mpiled gcc on the system and it didn't change anything. Actually, I found t= he solution when I tried to understand why configure detects a finite() fun= ction on a system which does not have it. First, I checked that there is no finite() function on my system: my libm.s= l file is a symbolic link to libm.2, which does not contain this function. = I don't know if it is the case for every HP-UX 11.11 system or if it is the= result of a patch (as there is another file in /usr/lib, named libm.1, whi= ch contains the finite() function, probably for compatibility). And this sy= mbol is not contained in any shared library under /usr (I checked them all). When configure checks to see if we have finite(), it attempts to compile a = small program containing 'dummy=3Dfinite(1.0)'. On my system, where I am us= ing 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 ! You can verify it with 'gcc -S -O2' or with 'nm' app= lied to the 'conftest' resulting executable file. After the call to finite(= ) has been removed, of course, the program compiles fine (it is empty now) = and configure wrongly concludes that we have finite(). In order for the check to be done correctly, we have to provide a program t= hat the compiler cannot optimize, ie where it cannot detect that the call i= s useless, even if it is very very smart. Here is a patch with such a progr= am. The fact of putting the call in a public function outside of main() for= ces the compiler to keep it, as it could be referenced from another file at= link time. $ diff configure.in configure.in.new 964c964 < [int dummy=3Dfinite(1.0);], --- > [return 0; } int is_f(number) double number; { return finite(number); ] After applying this patch on my system, everything works fine, HAVE_FINITE = is not defined and float.c correctly switches to the isfinite() macro, defi= ned in <math.h>. Regards Fran=E7ois
В списке pgsql-bugs по дате отправления: