]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/25158 (FAIL: gcc.c-torture/execute/builtins/fprintf.c compilation)
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Thu, 1 Dec 2005 02:31:49 +0000 (02:31 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Thu, 1 Dec 2005 02:31:49 +0000 (02:31 +0000)
PR middle-end/25158
* builtins.c (fold_builtin_fputs): Defer check for missing
replacement functions.

From-SVN: r107762

gcc/ChangeLog
gcc/builtins.c

index 1d8646a161bdbc793fc5e5202580cb80e18a31f9..5832c4ecf2b9e6a86f473877f16c8a0a58c497e8 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-30  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       PR middle-end/25158
+       * builtins.c (fold_builtin_fputs): Defer check for missing
+       replacement functions.
+
 2005-11-30  Kean Johnston  <jkj@sco.com>
 
        * config/i386/i386.c: Check the value of SUPPORTS_ONE_ONLY, not
index aff2499d6eda39a0d79c225f4ba4a25c248ce92c..2e42f468e44ea382bae9d1af57a323afd27bb620 100644 (file)
@@ -9327,9 +9327,8 @@ fold_builtin_fputs (tree arglist, bool ignore, bool unlocked, tree len)
   tree const fn_fwrite = unlocked ? built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
     : implicit_built_in_decls[BUILT_IN_FWRITE];
 
-  /* If the return value is used, or the replacement _DECL isn't
-     initialized, don't do the transformation.  */
-  if (!ignore || !fn_fputc || !fn_fwrite)
+  /* If the return value is used, don't do the transformation.  */
+  if (!ignore)
     return 0;
 
   /* Verify the arguments in the original call.  */
@@ -9391,6 +9390,11 @@ fold_builtin_fputs (tree arglist, bool ignore, bool unlocked, tree len)
       gcc_unreachable ();
     }
 
+  /* If the replacement _DECL isn't initialized, don't do the
+     transformation.  */
+  if (!fn)
+    return 0;
+
   /* These optimizations are only performed when the result is ignored,
      hence there's no need to cast the result to integer_type_node.  */
   return build_function_call_expr (fn, arglist);