diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-26 01:25:20 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-26 01:25:20 +0000 |
commit | 6d77ed9258cbd3bc0de2971c6c501140493686db (patch) | |
tree | 3361bfee7bbd0f755ff02c5d8d2bb9e0a58ca2d3 /gcc/builtins.c | |
parent | 4e741c1ddb038b1409c7c0c974c8f7f3ebfeb3ac (diff) | |
download | gcc-6d77ed9258cbd3bc0de2971c6c501140493686db.tar.gz |
PR middle-end/25022
* builtins.c (expand_builtin_printf, expand_builtin_fprintf,
fold_builtin_fputs, fold_builtin_printf, fold_builtin_fprintf):
Lookup the explicit replacement functions for any unlocked
stdio builtin transformations.
testsuite:
* gcc.c-torture/execute/builtins/fprintf.c,
gcc.c-torture/execute/builtins/fputs-lib.c,
gcc.c-torture/execute/builtins/fputs.c,
gcc.c-torture/execute/builtins/lib/fprintf.c,
gcc.c-torture/execute/builtins/lib/printf.c,
gcc.c-torture/execute/builtins/printf.c: Test the unlocked style.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107535 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 6cca5fbe37e..c2866ce5126 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -4843,11 +4843,12 @@ expand_builtin_printf (tree exp, rtx target, enum machine_mode mode, bool unlocked) { tree arglist = TREE_OPERAND (exp, 1); - tree fn_putchar = unlocked - ? implicit_built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED] - : implicit_built_in_decls[BUILT_IN_PUTCHAR]; - tree fn_puts = unlocked ? implicit_built_in_decls[BUILT_IN_PUTS_UNLOCKED] - : implicit_built_in_decls[BUILT_IN_PUTS]; + /* If we're using an unlocked function, assume the other unlocked + functions exist explicitly. */ + tree const fn_putchar = unlocked ? built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_PUTCHAR]; + tree const fn_puts = unlocked ? built_in_decls[BUILT_IN_PUTS_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_PUTS]; const char *fmt_str; tree fn, fmt, arg; @@ -4949,10 +4950,12 @@ expand_builtin_fprintf (tree exp, rtx target, enum machine_mode mode, bool unlocked) { tree arglist = TREE_OPERAND (exp, 1); - tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED] - : implicit_built_in_decls[BUILT_IN_FPUTC]; - tree fn_fputs = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTS_UNLOCKED] - : implicit_built_in_decls[BUILT_IN_FPUTS]; + /* If we're using an unlocked function, assume the other unlocked + functions exist explicitly. */ + tree const fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_FPUTC]; + tree const fn_fputs = unlocked ? built_in_decls[BUILT_IN_FPUTS_UNLOCKED] + : implicit_built_in_decls[BUILT_IN_FPUTS]; const char *fmt_str; tree fn, fmt, fp, arg; @@ -9611,9 +9614,11 @@ tree fold_builtin_fputs (tree arglist, bool ignore, bool unlocked, tree len) { tree fn; - tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED] + /* If we're using an unlocked function, assume the other unlocked + functions exist explicitly. */ + tree const fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED] : implicit_built_in_decls[BUILT_IN_FPUTC]; - tree fn_fwrite = unlocked ? implicit_built_in_decls[BUILT_IN_FWRITE_UNLOCKED] + 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 @@ -10752,8 +10757,10 @@ fold_builtin_printf (tree fndecl, tree arglist, bool ignore, if (fcode == BUILT_IN_PRINTF_UNLOCKED) { - fn_putchar = implicit_built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED]; - fn_puts = implicit_built_in_decls[BUILT_IN_PUTS_UNLOCKED]; + /* If we're using an unlocked function, assume the other + unlocked functions exist explicitly. */ + fn_putchar = built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED]; + fn_puts = built_in_decls[BUILT_IN_PUTS_UNLOCKED]; } else { @@ -10908,8 +10915,10 @@ fold_builtin_fprintf (tree fndecl, tree arglist, bool ignore, if (fcode == BUILT_IN_FPRINTF_UNLOCKED) { - fn_fputc = implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED]; - fn_fputs = implicit_built_in_decls[BUILT_IN_FPUTS_UNLOCKED]; + /* If we're using an unlocked function, assume the other + unlocked functions exist explicitly. */ + fn_fputc = built_in_decls[BUILT_IN_FPUTC_UNLOCKED]; + fn_fputs = built_in_decls[BUILT_IN_FPUTS_UNLOCKED]; } else { |