PR tree-optimization/88771 - Misleading -Werror=array-bounds error
authorMartin Sebor <msebor@redhat.com>
Mon, 11 Feb 2019 17:44:05 +0000 (17:44 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Mon, 11 Feb 2019 17:44:05 +0000 (10:44 -0700)
commit287ef129b68d25d219b167163a2494d82bee5820
treecdd2b8ec87767d99ab4bcddece5ee1e1a452fe6f
parent28a8cef1e240989c199dfd8538c826c134098f85
PR tree-optimization/88771 - Misleading -Werror=array-bounds error

gcc/ChangeLog:

PR tree-optimization/88771
* gimple-ssa-warn-restrict.c (pass_wrestrict::gate): Also enable
when -Wstringop-overflow is set.
(builtin_memref::builtin_memref): Adjust excessive upper bound
only when lower bound is not excessive.
(maybe_diag_overlap): Detect and diagnose excessive bounds via
-Wstringop-ovefflow.
(maybe_diag_offset_bounds): Rename...
(maybe_diag_access_bounds): ...to this.
(check_bounds_or_overlap): Adjust for name change above.

gcc/testsuite/ChangeLog:

PR tree-optimization/88771
* gcc.dg/Wstringop-overflow-8.c: New test.
* gcc.dg/Wstringop-overflow-9.c: New test.
* gcc.dg/Warray-bounds-40.c: New test.
* gcc.dg/builtin-stpncpy.c: Adjust.
* gcc.dg/builtin-stringop-chk-4.c: Adjust.
* g++.dg/opt/memcpy1.C: Adjust.

From-SVN: r268775
gcc/ChangeLog
gcc/gimple-ssa-warn-restrict.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/memcpy1.C
gcc/testsuite/gcc.dg/Warray-bounds-40.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstringop-overflow-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstringop-overflow-9.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-stpncpy.c
gcc/testsuite/gcc.dg/builtin-stringop-chk-4.c