diff options
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 975f696..8d0288f 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_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, enum built_in_function); @@ -10366,9 +10365,6 @@ fold_builtin_4 (location_t loc, tree fndecl, switch (fcode) { - case BUILT_IN_STRNCAT_CHK: - return fold_builtin_strncat_chk (loc, fndecl, arg0, arg1, arg2, arg3); - case BUILT_IN_FPRINTF_CHK: case BUILT_IN_VFPRINTF_CHK: if (!validate_arg (arg1, INTEGER_TYPE) @@ -11584,58 +11580,6 @@ fold_builtin_object_size (tree ptr, tree ost) return NULL_TREE; } -/* Fold a call to the __strncat_chk builtin with arguments DEST, SRC, - LEN, and SIZE. */ - -static tree -fold_builtin_strncat_chk (location_t loc, tree fndecl, - tree dest, tree src, tree len, tree size) -{ - tree fn; - const char *p; - - if (!validate_arg (dest, POINTER_TYPE) - || !validate_arg (src, POINTER_TYPE) - || !validate_arg (size, INTEGER_TYPE) - || !validate_arg (size, INTEGER_TYPE)) - return NULL_TREE; - - p = c_getstr (src); - /* If the SRC parameter is "" or if LEN is 0, return DEST. */ - if (p && *p == '\0') - return omit_one_operand_loc (loc, TREE_TYPE (TREE_TYPE (fndecl)), dest, len); - else if (integer_zerop (len)) - return omit_one_operand_loc (loc, TREE_TYPE (TREE_TYPE (fndecl)), dest, src); - - if (! tree_fits_uhwi_p (size)) - return NULL_TREE; - - if (! integer_all_onesp (size)) - { - tree src_len = c_strlen (src, 1); - if (src_len - && tree_fits_uhwi_p (src_len) - && tree_fits_uhwi_p (len) - && ! tree_int_cst_lt (len, src_len)) - { - /* If LEN >= strlen (SRC), optimize into __strcat_chk. */ - fn = builtin_decl_explicit (BUILT_IN_STRCAT_CHK); - if (!fn) - return NULL_TREE; - - return build_call_expr_loc (loc, fn, 3, dest, src, size); - } - return NULL_TREE; - } - - /* If __builtin_strncat_chk is used, assume strncat is available. */ - fn = builtin_decl_explicit (BUILT_IN_STRNCAT); - if (!fn) - return NULL_TREE; - - return build_call_expr_loc (loc, fn, 3, dest, src, len); -} - /* Builtins with folding operations that operate on "..." arguments need special handling; we need to store the arguments in a convenient data structure before attempting any folding. Fortunately there are |