diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-15 17:26:10 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-15 17:26:10 +0000 |
commit | 1063acdeacf6bcc188454e095ece2951872e8704 (patch) | |
tree | b55d26e2a650daf51259ff6f927c4f13e216f931 /gcc/gimple-fold.c | |
parent | 4f3bff831367fbc16103d0039801ac81b7926107 (diff) | |
download | gcc-1063acdeacf6bcc188454e095ece2951872e8704.tar.gz |
* builtins.def (BUILT_IN_STPNCPY_CHK): New definition.
* builtins.c (expand_builtin, fold_builtin_4, maybe_emit_chk_warning):
Add BUILT_IN_STPNCPY_CHK case.
* gimple-fold.c (gimple_fold_builtin): Likewise.
* tree-object-size.c (pass_through_call): Likewise.
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1,
call_may_clobber_ref_p_1): Likewise.
* tree-ssa-structalias.c (find_func_aliases_for_builtin_call,
find_func_clobbers): Likewise.
* tree.h (fold_builtin_strncpy_chk): Rename to fold_builtin_stxncpy_chk
* builtins.c (fold_builtin_strncpy_chk): Likewise.
Rewrite stpncpy_chk calls to strncpy_chk calls if returned value is
ignored.
* gcc.c-torture/execute/builtins/chk.h (stpncpy, stpncpy_disallowed):
New definitions.
* gcc.c-torture/execute/builtins/lib/chk.c (stpncpy_disallowed):
Likewise.
(stpncpy, __stpncpy_chk): New functions.
* gcc.c-torture/execute/builtins/stpncpy-chk-lib.c: New file.
* gcc.c-torture/execute/builtins/stpncpy-chk.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182378 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 91dd8fc5892..935bbdae9ee 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -834,6 +834,7 @@ gimple_fold_builtin (gimple stmt) case BUILT_IN_MEMMOVE_CHK: case BUILT_IN_MEMSET_CHK: case BUILT_IN_STRNCPY_CHK: + case BUILT_IN_STPNCPY_CHK: arg_idx = 2; type = 2; break; @@ -940,12 +941,14 @@ gimple_fold_builtin (gimple stmt) break; case BUILT_IN_STRNCPY_CHK: + case BUILT_IN_STPNCPY_CHK: if (val[2] && is_gimple_val (val[2]) && nargs == 4) - result = fold_builtin_strncpy_chk (loc, gimple_call_arg (stmt, 0), + result = fold_builtin_stxncpy_chk (loc, gimple_call_arg (stmt, 0), gimple_call_arg (stmt, 1), gimple_call_arg (stmt, 2), gimple_call_arg (stmt, 3), - val[2]); + val[2], ignore, + DECL_FUNCTION_CODE (callee)); break; case BUILT_IN_SNPRINTF_CHK: |