https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91457
Christophe Lyon <clyon at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clyon at gcc dot gnu.org
--- Comment #8 from Christophe Lyon <clyon at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #5)
> Author: msebor
> Date: Wed Aug 28 16:43:56 2019
> New Revision: 274997
>
> URL: https://gcc.gnu.org/viewcvs?rev=274997&root=gcc&view=rev
> Log:
> 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.
>
>
> Added:
> trunk/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
> trunk/gcc/testsuite/g++.dg/warn/Warray-bounds-8.C
> trunk/gcc/testsuite/g++.dg/warn/Wstringop-overflow-3.C
> trunk/gcc/testsuite/gcc.dg/Wstringop-overflow-15.c
> Modified:
> trunk/gcc/ChangeLog
> trunk/gcc/builtins.c
> trunk/gcc/builtins.h
> trunk/gcc/testsuite/ChangeLog
> trunk/gcc/tree-ssa-strlen.c
> trunk/gcc/tree-vrp.c
Hi,
After this was committed, I'm seeing glibc (2.29) build errors for arm and
aarch64, but that's probably true on other targets:
programs/ld-ctype.c: In function 'ctype_finish':
cc1: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
In file included from programs/repertoire.h:24,
from programs/localedef.h:32,
from programs/ld-ctype.c:35:
programs/charmap.h:63:17: note: destination object declared here
63 | unsigned char bytes[0];
| ^~~~~
cc1: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
programs/charmap.h:63:17: note: destination object declared here
cc1: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
programs/charmap.h:63:17: note: destination object declared here
cc1: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
programs/charmap.h:63:17: note: destination object declared here