From 1063acdeacf6bcc188454e095ece2951872e8704 Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 15 Dec 2011 17:26:10 +0000 Subject: * 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 --- gcc/tree-ssa-structalias.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-structalias.c') diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 08d480a0d86..56ffca556e9 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4022,6 +4022,7 @@ find_func_aliases_for_builtin_call (gimple t) case BUILT_IN_MEMMOVE_CHK: case BUILT_IN_MEMPCPY_CHK: case BUILT_IN_STPCPY_CHK: + case BUILT_IN_STPNCPY_CHK: case BUILT_IN_STRCAT_CHK: case BUILT_IN_STRNCAT_CHK: case BUILT_IN_TM_MEMCPY: @@ -4039,7 +4040,8 @@ find_func_aliases_for_builtin_call (gimple t) || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STPCPY || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STPNCPY || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMPCPY_CHK - || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STPCPY_CHK) + || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STPCPY_CHK + || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STPNCPY_CHK) get_constraint_for_ptr_offset (dest, NULL_TREE, &rhsc); else get_constraint_for (dest, &rhsc); @@ -4757,6 +4759,7 @@ find_func_clobbers (gimple origt) case BUILT_IN_MEMMOVE_CHK: case BUILT_IN_MEMPCPY_CHK: case BUILT_IN_STPCPY_CHK: + case BUILT_IN_STPNCPY_CHK: case BUILT_IN_STRCAT_CHK: case BUILT_IN_STRNCAT_CHK: { -- cgit v1.2.1