------- Comment #8 from rguenth at gcc dot gnu dot org 2006-12-14 16:18 -------
trunc maybe available in the library, but gcc thinks it is not. Otherwise the
testcase wouldn't fail - it tests for the transformation of floor (x) to trunc
(x)
if x is known to be positive.
Now if std=c99 does not help I can only make this a link-time testcase like
(-ffinite-math-only to allow folding the FP comparison).
That does work, right?
/* { dg-do link } */
/* { dg-options "-std=c99 -ffinite-math-only" } */
#include "builtins-config.h"
extern void link_error (void);
extern double floor (double);
extern double trunc (double);
extern double fabs (double);
void test (double x)
{
#ifdef HAVE_C99_RUNTIME
if (floor (fabs (x)) != trunc (fabs (x)))
link_error ();
#endif
if (__builtin_lfloor (fabs (x)) != (long)fabs (x))
link_error ();
}
int main (void)
{
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30181