]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
builtins.c (fold_builtin_floor): Check for the availability of the C99 trunc function...
authorRoger Sayle <roger@eyesopen.com>
Mon, 30 Oct 2006 01:14:37 +0000 (01:14 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Mon, 30 Oct 2006 01:14:37 +0000 (01:14 +0000)
* builtins.c (fold_builtin_floor): Check for the availability of
the C99 trunc function before transforming floor into trunc.

From-SVN: r118168

gcc/ChangeLog
gcc/builtins.c

index c4f0bcd6cc7f85535621f2016a5b7ac31fedab29..0d31903dc0436c35e3e6bb0a3e9cd4aebe00359b 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-29  Roger Sayle  <roger@eyesopen.com>
+
+       * 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  <ghazi@caip.rutgers.edu>
 
        * builtins.c (fold_builtin_hypot): Rearrange recursive
index 3af86cc105816c5652db181f0bc8025631779efd..b3e82d5d187ac5a00e295037e8edd176acd520d2 100644 (file)
@@ -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);
 }