"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