On 8/28/19 9:44 AM, Martin Sebor wrote:
> With the PR 91490 subset committed, attached is what's left
> of the original fix. It seems simple enough that I decided it's
> not worth chopping up any further. The meat of the change is in
> builtins.c. Everything else just adjusts warnings either by
> making use of it (tree-ssa-strlen.c) or by setting the no-warning
> bit (tree-vrp.c).
>
> Retested on x86_64-linux.
>
> Martin
>
> gcc-91457.diff
>
> 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.
OK
jeff