PR tree-optimization/83698 - bogus offset in -Wrestrict messages for strcat of unknow...
authorMartin Sebor <msebor@redhat.com>
Wed, 14 Feb 2018 23:22:15 +0000 (23:22 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 14 Feb 2018 23:22:15 +0000 (16:22 -0700)
commit816fad6ed44fb327c4034c40eb9d2bccafd6538d
tree4abe2f0ee56e212baf1980d760fbb71436a2cbfb
parent7c102986d6f8205ebc3952344c64edbcd7018fbc
PR tree-optimization/83698 - bogus offset in -Wrestrict messages for strcat of unknown strings

gcc/ChangeLog:

PR tree-optimization/83698
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): For
arrays constrain the offset range to their bounds.
(builtin_access::strcat_overlap): Adjust the bounds of overlap offset.
(builtin_access::overlap): Avoid setting the size of overlap if it's
already been set.
(maybe_diag_overlap): Also consider arrays when deciding what values
of offsets to include in diagnostics.

gcc/testsuite/ChangeLog:

PR tree-optimization/83698
* gcc.dg/Wrestrict-7.c: New test.
* c-c++-common/Wrestrict.c: Adjust expected values for strcat.
* gcc.target/i386/chkp-stropt-17.c: Same.

From-SVN: r257676
gcc/ChangeLog
gcc/gimple-ssa-warn-restrict.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wrestrict.c
gcc/testsuite/gcc.dg/Wrestrict-7.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/chkp-stropt-17.c