]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
builtins.c (fold_builtin_fabs): Convert argument to the appropriate type as args...
authorRoger Sayle <roger@eyesopen.com>
Wed, 12 Jan 2005 06:45:35 +0000 (06:45 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Wed, 12 Jan 2005 06:45:35 +0000 (06:45 +0000)
* builtins.c (fold_builtin_fabs): Convert argument to the appropriate
type as args of unprototyped builtins aren't automatically promoted.
(fold_builtin_abs): Likewise.

From-SVN: r93220

gcc/ChangeLog
gcc/builtins.c

index 587891ac14fbf5311e6afd751ce8c478b988c4fd..aa89b845fda6fb41a269a496fc3d60786d3d82c7 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-11  Roger Sayle  <roger@eyesopen.com>
+
+       * builtins.c (fold_builtin_fabs): Convert argument to the appropriate
+       type as args of unprototyped builtins aren't automatically promoted.
+       (fold_builtin_abs): Likewise.
+
 2005-01-11  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Makefile.in: Set a `build-warn' variable.
index e231d8361cc4561c6752ace9fb2c20c9eaf400fc..a13ecef5f656fcd406179a84ebeee87cd9bf2b02 100644 (file)
@@ -7461,6 +7461,7 @@ fold_builtin_fabs (tree arglist, tree type)
     return 0;
 
   arg = TREE_VALUE (arglist);
+  arg = fold_convert (type, arg);
   if (TREE_CODE (arg) == REAL_CST)
     return fold_abs_const (arg, type);
   return fold (build1 (ABS_EXPR, type, arg));
@@ -7477,6 +7478,7 @@ fold_builtin_abs (tree arglist, tree type)
     return 0;
 
   arg = TREE_VALUE (arglist);
+  arg = fold_convert (type, arg);
   if (TREE_CODE (arg) == INTEGER_CST)
     return fold_abs_const (arg, type);
   return fold (build1 (ABS_EXPR, type, arg));