https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83698
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- Author: msebor Date: Wed Feb 14 23:22:15 2018 New Revision: 257676 URL: https://gcc.gnu.org/viewcvs?rev=257676&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/gcc.dg/Wrestrict-7.c Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-ssa-warn-restrict.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/c-c++-common/Wrestrict.c trunk/gcc/testsuite/gcc.target/i386/chkp-stropt-17.c