> 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 compiler may deduce that isinf((double)argc) always
> returns false, without ever calling the function.
You're too clever. :-)
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;
}
--
Eric Botcazou