Re: BUG #2162: Same as bug #1679 - finite() - unresolved symbol - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2162: Same as bug #1679 - finite() - unresolved symbol
Date
Msg-id 28007.1137012584@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2162: Same as bug #1679 - finite() - unresolved symbol  ("Francois Laupretre" <flconseil@yahoo.fr>)
List pgsql-bugs
"F. Laupretre" <flconseil@yahoo.fr> writes:
> 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 !

Argh!  gcc couldn't do that in general, of course --- it must be using
some built-in knowledge that finite() doesn't have side-effects.
I'll have to look at how AC_CHECK_FUNC() avoids that.  Obviously we
are getting bit because our homegrown check for finite() isn't smart
enough.

I'd actually argue that this is a gcc bug: when there is no declaration
of finite() in the system headers (there isn't is there?) it's wrong to
conclude just on the name of the function that it is side-effect-free.
But I don't suppose a fix will be forthcoming quickly, so we'll have to
work around it.

Thanks for taking the trouble to chase this down.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: createlang plpgsql failed
Next
From: Tom Lane
Date:
Subject: Re: BUG #2162: Same as bug #1679 - finite() - unresolved symbol