diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-27 08:01:25 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-27 08:01:25 +0000 |
commit | 95f5ab8d7313cc1b7f4ce3ed150815a338a3c526 (patch) | |
tree | 60748f8fb1fb8fb65da82dd94574e47a560dbb66 /gcc/builtins.c | |
parent | bd464103edd527f05491c20fe41d0dfc02f3d8a3 (diff) |
2014-08-27 Richard Biener <rguenther@suse.de>
PR middle-end/62239
* builtins.c (fold_builtin_strcat_chk): Move to gimple-fold.c.
(fold_builtin_3): Do not fold strcat_chk here.
* gimple-fold.c (gimple_fold_builtin_strcat_chk): Move here
from builtins.c.
(gimple_fold_builtin): Fold strcat_chk here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214564 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index e5a9b4d7228..20add5ffbec 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -198,7 +198,6 @@ static void maybe_emit_chk_warning (tree, enum built_in_function); static void maybe_emit_sprintf_chk_warning (tree, enum built_in_function); static void maybe_emit_free_warning (tree); static tree fold_builtin_object_size (tree, tree); -static tree fold_builtin_strcat_chk (location_t, tree, tree, tree, tree); static tree fold_builtin_strncat_chk (location_t, tree, tree, tree, tree, tree); static tree fold_builtin_printf (location_t, tree, tree, tree, bool, enum built_in_function); static tree fold_builtin_fprintf (location_t, tree, tree, tree, tree, bool, @@ -10321,9 +10320,6 @@ fold_builtin_3 (location_t loc, tree fndecl, case BUILT_IN_MEMCMP: return fold_builtin_memcmp (loc, arg0, arg1, arg2);; - case BUILT_IN_STRCAT_CHK: - return fold_builtin_strcat_chk (loc, fndecl, arg0, arg1, arg2); - case BUILT_IN_PRINTF_CHK: case BUILT_IN_VPRINTF_CHK: if (!validate_arg (arg0, INTEGER_TYPE) @@ -11588,37 +11584,6 @@ fold_builtin_object_size (tree ptr, tree ost) return NULL_TREE; } -/* Fold a call to the __strcat_chk builtin FNDECL. DEST, SRC, and SIZE - are the arguments to the call. */ - -static tree -fold_builtin_strcat_chk (location_t loc, tree fndecl, tree dest, - tree src, tree size) -{ - tree fn; - const char *p; - - if (!validate_arg (dest, POINTER_TYPE) - || !validate_arg (src, POINTER_TYPE) - || !validate_arg (size, INTEGER_TYPE)) - return NULL_TREE; - - p = c_getstr (src); - /* If the SRC parameter is "", return DEST. */ - if (p && *p == '\0') - return omit_one_operand_loc (loc, TREE_TYPE (TREE_TYPE (fndecl)), dest, src); - - if (! tree_fits_uhwi_p (size) || ! integer_all_onesp (size)) - return NULL_TREE; - - /* If __builtin_strcat_chk is used, assume strcat is available. */ - fn = builtin_decl_explicit (BUILT_IN_STRCAT); - if (!fn) - return NULL_TREE; - - return build_call_expr_loc (loc, fn, 2, dest, src); -} - /* Fold a call to the __strncat_chk builtin with arguments DEST, SRC, LEN, and SIZE. */ |