PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
authorMartin Sebor <msebor@redhat.com>
Mon, 18 Jun 2018 22:17:57 +0000 (22:17 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Mon, 18 Jun 2018 22:17:57 +0000 (16:17 -0600)
commit4252ccd73701a330db365ccd39829e27d0d3b42d
tree18e21cecd1210c34cebb0fd5809861a217fbf0eb
parent9e03592e40e7da85f9779ea1988a69f154d1ba7f
PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source

gcc/c-family/ChangeLog:

PR middle-end/85602
* c-warn.c (sizeof_pointer_memaccess_warning): Check for attribute
nonstring.

gcc/ChangeLog:

PR middle-end/85602
* calls.c (maybe_warn_nonstring_arg): Handle strncat.
* tree-ssa-strlen.c (is_strlen_related_p): Make extern.
Handle integer subtraction.
(maybe_diag_stxncpy_trunc): Handle nonstring source arguments.
* tree-ssa-strlen.h (is_strlen_related_p): Declare.

gcc/testsuite/ChangeLog:

PR middle-end/85602
* gcc.dg/attr-nonstring-2.c: Adjust text of expected warning.
* c-c++-common/attr-nonstring-8.c: New test.

From-SVN: r261718
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-warn.c
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/attr-nonstring-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/attr-nonstring-2.c
gcc/tree-ssa-strlen.c
gcc/tree-ssa-strlen.h