diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c4f0bcd6cc7f..0d31903dc043 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2006-10-29 Roger Sayle + + * builtins.c (fold_builtin_floor): Check for the availability of + the C99 trunc function before transforming floor into trunc. + 2006-10-29 Kaveh R. Ghazi * builtins.c (fold_builtin_hypot): Rearrange recursive diff --git a/gcc/builtins.c b/gcc/builtins.c index 3af86cc10581..b3e82d5d187a 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -7311,9 +7311,11 @@ fold_builtin_floor (tree fndecl, tree arglist) /* Fold floor (x) where x is nonnegative to trunc (x). */ if (tree_expr_nonnegative_p (arg)) - return build_function_call_expr (mathfn_built_in (TREE_TYPE (arg), - BUILT_IN_TRUNC), - arglist); + { + tree truncfn = mathfn_built_in (TREE_TYPE (arg), BUILT_IN_TRUNC); + if (truncfn) + return build_function_call_expr (truncfn, arglist); + } return fold_trunc_transparent_mathfn (fndecl, arglist); }