https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85623
--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> --- Author: msebor Date: Mon Jun 4 15:35:49 2018 New Revision: 261152 URL: https://gcc.gnu.org/viewcvs?rev=261152&root=gcc&view=rev Log: 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. Added: branches/gcc-8-branch/gcc/testsuite/c-c++-common/attr-nonstring-6.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/calls.c branches/gcc-8-branch/gcc/testsuite/ChangeLog branches/gcc-8-branch/gcc/testsuite/c-c++-common/attr-nonstring-3.c branches/gcc-8-branch/gcc/testsuite/c-c++-common/attr-nonstring-4.c