On 05/11/2018 10:21 AM, Martin Sebor wrote: > The attached tweak suppresses some -Wstringop-truncation false > positives when a pointer into an array declared nonstring is > passed to a function that expects a string argument such as in: > > char a[8] __attribute__ ((nonstring)); > strncpy (a + 1, s, sizeof a - 1); > > I'd like to commit this fix to both trunk and 8-branch. > > Thanks > Martin > > gcc-85643.diff > > > PR middle-end/85643 - attribute nonstring fails to squash > -Wstringop-truncation warning > > gcc/ChangeLog: > > PR middle-end/85643 > * calls.c (get_attr_nonstring_decl): Handle MEM_REF. > > gcc/testsuite/ChangeLog: > > PR middle-end/85643 > * c-c++-common/attr-nonstring-7.c: New test. OK for the trunk. It's borderline for the release branch, but I'll ack it there too after a week of soak time on the trunk.
jeff