aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2005-12-01 02:31:49 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2005-12-01 02:31:49 +0000
commit625a34391b5f4ade156cd99b88fd5184011d2a29 (patch)
treecdcde4f7780bd6812328a85c7bcd53f7041439a5 /gcc/builtins.c
parent57fdce262e62bbaeb666e2c733c5f69486deb240 (diff)
downloadgcc-625a34391b5f4ade156cd99b88fd5184011d2a29.zip
gcc-625a34391b5f4ade156cd99b88fd5184011d2a29.tar.gz
gcc-625a34391b5f4ade156cd99b88fd5184011d2a29.tar.bz2
re PR middle-end/25158 (FAIL: gcc.c-torture/execute/builtins/fprintf.c compilation)
PR middle-end/25158 * builtins.c (fold_builtin_fputs): Defer check for missing replacement functions. From-SVN: r107762
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index aff2499..2e42f46 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -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);