diff options
author | msebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-11-21 21:44:26 +0000 |
---|---|---|
committer | msebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-11-21 21:44:26 +0000 |
commit | 9ec8f524b89845eee94286cf082a55270c3d51b6 (patch) | |
tree | 1e8138ec29f2adab2ddeda0913bae95d9c500e20 /gcc | |
parent | 7086d631bbca33f0f355ef571d0c4802be249ce8 (diff) | |
download | gcc-9ec8f524b89845eee94286cf082a55270c3d51b6.tar.gz |
gcc/ChangeLog:
PR tree-optimization/82945
* calls.h (warn_nonstring_bound): Remove unused function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255036 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/calls.c | 52 |
2 files changed, 5 insertions, 52 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a4e92fb751..60af13ab350 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,11 @@ 2017-11-21 Martin Sebor <msebor@redhat.com> PR tree-optimization/82945 + * calls.h (warn_nonstring_bound): Remove unused function. + +2017-11-21 Martin Sebor <msebor@redhat.com> + + PR tree-optimization/82945 * builtins.c (expand_builtin_strlen): Call maybe_warn_nonstring_arg. * calls.h (maybe_warn_nonstring_arg): Declare new function. * calls.c (get_attr_nonstring_decl, maybe_warn_nonstring_arg): New diff --git a/gcc/calls.c b/gcc/calls.c index cae543c481f..64f9f50876b 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1535,58 +1535,6 @@ get_attr_nonstring_decl (tree expr, tree *ref) return NULL_TREE; } -/* Check the size argument to the strncmp built-in to see if it's within - the bounds of the arguments and if not, issue a warning. */ - -static void -warn_nonstring_bound (tree fndecl, tree call) -{ - bool with_bounds = CALL_WITH_BOUNDS_P (call); - - tree cnt = CALL_EXPR_ARG (call, with_bounds ? 4 : 2); - - tree cntrange[2]; - if (!get_size_range (cnt, cntrange)) - return; - - location_t callloc = EXPR_LOCATION (call); - - for (unsigned i = 0; i != 2; ++i) - { - tree str = CALL_EXPR_ARG (call, i + 2 * with_bounds); - - tree sref; - tree decl = get_attr_nonstring_decl (str, &sref); - if (!decl) - continue; - - tree type = TREE_TYPE (decl); - if (TREE_CODE (type) != ARRAY_TYPE) - continue; - - tree dom = TYPE_DOMAIN (type); - if (!dom) - continue; - - tree bound = TYPE_MAX_VALUE (dom); - if (!bound) - continue; - - bool warned = false; - if (tree_int_cst_le (bound, cntrange[0])) - warned = warning_at (callloc, OPT_Wstringop_truncation, - "%qD argument %i declared attribute %<nonstring%> " - "is smaller than the specified bound %E", - fndecl, i, cntrange[0]); - if (warned) - { - location_t loc = DECL_SOURCE_LOCATION (decl); - if (loc != UNKNOWN_LOCATION) - inform (loc, "argument %qD declared here", decl); - } - } -} - /* Warn about passing a non-string array/pointer to a function that expects a nul-terminated string argument. */ |