Re: isinf

2005-07-14 Thread Andreas Schwab
Jakub Jelinek <[EMAIL PROTECTED]> writes: > Guess that's because AC_HAVE_FUNCS(isinf) is wrong. > isinf/isfinite/fpclassify are all documented as macros in ISO C99. > So >[AC_MSG_CHECKING(for isinf with ) > AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include > volatile int x; volatile float f;]],

Re: isinf

2005-07-14 Thread Jakub Jelinek
On Thu, Jul 14, 2005 at 06:27:06PM +0900, Hiroshi Fujishima wrote: > Andreas Schwab <[EMAIL PROTECTED]> writes: > > > Why not just use AC_HAVE_FUNCS(isinf)? IIUC this is part of a configure > > script, although whether it is autoconf generated is not clear so far. > > Though I don't know the why

Re: isinf

2005-07-14 Thread Hiroshi Fujishima
Andreas Schwab <[EMAIL PROTECTED]> writes: > Why not just use AC_HAVE_FUNCS(isinf)? IIUC this is part of a configure > script, although whether it is autoconf generated is not clear so far. Though I don't know the why, rrdtool-1.2.10/configure.ac has the following macro. dnl HP-UX 11.00 does no

Re: isinf

2005-07-14 Thread Eric Botcazou
> Why not just use AC_HAVE_FUNCS(isinf)? IIUC this is part of a configure > script, although whether it is autoconf generated is not clear so far. Real men write their configure checks by hand, although whether the rrdtool maintainer is a male is not clear so far. ;-) -- Eric Botcazou

Re: isinf

2005-07-14 Thread Andreas Schwab
Michael Veksler <[EMAIL PROTECTED]> writes: > Maybe there is a simpler way? For example: > > volatile int a; > volatile double b; > int main () > { >a = isinf (b); >return 0; > } > > This way the compiler must not assume anything about 'b', > making it impossible to optimizes the call to i

Re: isinf

2005-07-14 Thread Michael Veksler
Eric Botcazou <[EMAIL PROTECTED]> wrote on 14/07/2005 10:05:50: [...] > union U { > int i; > double d; > }; > > volatile int a; > > int > main (int argc, char *argv[]) > { > union U u; > u.i = argc; > a = isinf (u.d); > return 0; > } > Doesn't the code display undefined behavior wh

Re: isinf

2005-07-14 Thread Eric Botcazou
> This may work today, but and still break in the future. This > will not work (possibly) years from now when gcc will start > doing VRP on math functions like isinf. > > MIN_INT <= argc <= MAX_INT falls well into representable > values of double (assuming 32 bit int or less). This means > that the

Re: isinf

2005-07-13 Thread Michael Veksler
Eric Botcazou wrote on 14/07/2005 08:59:53: > The compiler knows the answer of isinf (0) so it again optimizes away the > call. Try something like: > > int a; > > int > main (int argc, char *argv[]) > { > a = isinf ((double) argc); > return 0; > } This may work today, but and still br

Re: isinf

2005-07-13 Thread Eric Botcazou
> Oops, the configure script compiling with -O2 optimization. Clearly not the best option for this kind of tests. > The compilation of the following code still suceesss. > > #include > > int a; > > int > main () > { > float f = 0.0; > a = isinf (f); > return 0; > } The compiler knows the

Re: isinf

2005-07-13 Thread Hiroshi Fujishima
Joe Buck <[EMAIL PROTECTED]> writes: >> >> The configure script which is included in rrdtool[1] checks whether >> >> the system has isinf() as below. >> >> >> >> #include >> >> int >> >> main () >> >> { >> >> float f = 0.0; isinf(f) >> >> ; >> >> return 0; >> >> } >> > >> > The test is clearl

Re: isinf

2005-07-13 Thread Dale Johannesen
On Jul 13, 2005, at 4:29 PM, Joe Buck wrote: On Thu, Jul 14, 2005 at 08:16:07AM +0900, Hiroshi Fujishima wrote: Eric Botcazou <[EMAIL PROTECTED]> writes: The configure script which is included in rrdtool[1] checks whether the system has isinf() as below. #include int main () { float f = 0.0;

Re: isinf

2005-07-13 Thread Joe Buck
On Thu, Jul 14, 2005 at 08:16:07AM +0900, Hiroshi Fujishima wrote: > Eric Botcazou <[EMAIL PROTECTED]> writes: > > >> The configure script which is included in rrdtool[1] checks whether > >> the system has isinf() as below. > >> > >> #include > >> int > >> main () > >> { > >> float f = 0.0; isinf

Re: isinf

2005-07-13 Thread Hiroshi Fujishima
Eric Botcazou <[EMAIL PROTECTED]> writes: >> The configure script which is included in rrdtool[1] checks whether >> the system has isinf() as below. >> >> #include >> int >> main () >> { >> float f = 0.0; isinf(f) >> ; >> return 0; >> } > > The test is clearly fragile. Assigning the return v

Re: isinf

2005-07-13 Thread Eric Botcazou
> > Because the call to isinf is optimized away even at -O0 in the latter > > case (isinf being a pure function), but not in the former. That could be > > deemed a little questionable though. The gap is eliminated at -O1. > > Thank you for explication. Is it gcc's expected behavior? It is valid

Re: isinf

2005-07-13 Thread Hiroshi Fujishima
Eric Botcazou <[EMAIL PROTECTED]> writes: >> Why does the compilation of b.c fail, while that of a.c succeeds with >> gcc-4.0.0 or later? > > Because the call to isinf is optimized away even at -O0 in the latter case > (isinf being a pure function), but not in the former. That could be deemed >

Re: isinf

2005-07-13 Thread Eric Botcazou
> Why does the compilation of b.c fail, while that of a.c succeeds with > gcc-4.0.0 or later? Because the call to isinf is optimized away even at -O0 in the latter case (isinf being a pure function), but not in the former. That could be deemed a little questionable though. The gap is eliminate