PR c/85623 - strncmp() warns about attribute 'nonstring' incorrectly in -Wstringop...
authorMartin Sebor <msebor@redhat.com>
Tue, 22 May 2018 17:45:35 +0000 (17:45 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Tue, 22 May 2018 17:45:35 +0000 (11:45 -0600)
commitd677a8b6818b1682bfccae40cceb7264b53c1018
tree8bcb9d057f75ddb91c415569f50789f538e99968
parent9b56ec1111632f4e9a47ba5388d7a65c19593f71
PR c/85623 - strncmp() warns about attribute 'nonstring' incorrectly in -Wstringop-overflow

gcc/ChangeLog:

PR c/85623
* calls.c (maybe_warn_nonstring_arg): Use string length to set
or ajust the presumed bound on an operation to avoid unnecessary
warnings.

gcc/testsuite/ChangeLog:

PR c/85623
* c-c++-common/attr-nonstring-3.c: Adjust.
* c-c++-common/attr-nonstring-4.c: Adjust.
* c-c++-common/attr-nonstring-6.c: New test.

From-SVN: r260541
gcc/ChangeLog
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/attr-nonstring-3.c
gcc/testsuite/c-c++-common/attr-nonstring-4.c
gcc/testsuite/c-c++-common/attr-nonstring-6.c [new file with mode: 0644]