PR tree-optimization/91457 - inconsistent warning for writing past the end of an...
authorMartin Sebor <msebor@redhat.com>
Wed, 28 Aug 2019 16:43:56 +0000 (16:43 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 28 Aug 2019 16:43:56 +0000 (10:43 -0600)
commit464969eb9b47eb2f24403c74c16769a58dbaa638
tree821481a2cfc3a3c99c5d25b19c08cd56afef8e58
parente2eee239811d4335f28ccdf7c2d9c490fcf6612d
PR tree-optimization/91457 - inconsistent warning for writing past the end of an array member

gcc/ChangeLog:

PR tree-optimization/91457
* builtins.c (component_size): New function.
(compute_objsize): Add argument. Handle ARRAY_REF and COMPONENT_REF.
* builtins.h (compute_objsize): Add argument.
* tree-ssa-strlen.c (handle_store): Handle no-warning bit.
* tree-vrp.c (vrp_prop::check_array_ref): Return warning result.
(vrp_prop::check_mem_ref): Same.
(vrp_prop::search_for_addr_array): Set no-warning bit.
(check_array_bounds): Same.

gcc/testsuite/ChangeLog:

PR tree-optimization/91457
* c-c++-common/Wstringop-overflow-2.c: New test.
* g++.dg/warn/Warray-bounds-8.C: New test.
* g++.dg/warn/Wstringop-overflow-3.C: New test.
* gcc.dg/Wstringop-overflow-15.c: New test.

From-SVN: r274997
gcc/ChangeLog
gcc/builtins.c
gcc/builtins.h
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wstringop-overflow-2.c [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Warray-bounds-8.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wstringop-overflow-3.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstringop-overflow-15.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c
gcc/tree-vrp.c