On Tue, 2020-07-28 at 19:22 -0600, Martin Sebor via Gcc-patches wrote: > Patch 4 adds support to the machinery behind -Wstringop-overflow > to issue warnings for (likely) out of bounds accesses in calls to > functions with the internal attribute access specification. This > implements the feature pr50584 asks for (plus more).
> [4/5] - Extend -Wstringop-overflow to detect out-of-bounds accesses to array > parameters. > > gcc/ChangeLog: > > * tree-ssa-uninit.c (maybe_warn_pass_by_reference): Handle attribute > access internal representation of arrays. > > gcc/testsuite/ChangeLog: > > * gcc.dg/uninit-37.c: New test. > > gcc/ChangeLog: > > PR c/50584 > * builtins.c (warn_for_access): Add argument. Distinguish between > reads and writes. > (check_access): Add argument. Distinguish between reads and writes. > (gimple_call_alloc_size): Set range even on failure. > (gimple_parm_array_size): New function. > (compute_objsize): Call it. > (check_memop_access): Pass check_access an additional argument. > (expand_builtin_memchr, expand_builtin_strcat): Same. > (expand_builtin_strcpy, expand_builtin_stpcpy_1): Same. > (expand_builtin_stpncpy, check_strncat_sizes): Same. > (expand_builtin_strncat, expand_builtin_strncpy): Same. > (expand_builtin_memcmp): Same. > * builtins.h (compute_objsize): Declare a new overload. > (gimple_parm_array_size): Declare. > (check_access): Add argument. > * calls.c (append_attrname): Simplify. > (maybe_warn_rdwr_sizes): Handle internal attribute access. > > gcc/testsuite/ChangeLog: > > PR c/50584 > * c-c++-common/Wsizeof-pointer-memaccess1.c: Disable new expected > warnings. > * g++.dg/ext/attr-access.C: Update text of expected warnings. > * gcc.dg/Wstringop-overflow-23.c: Same. > * gcc.dg/Wstringop-overflow-24.c: Same. > * gcc.dg/attr-access-none.c: Same. > * gcc.dg/Wstringop-overflow-40.c: New test. > * gcc.dg/attr-access-2.c: New test. OK once the prereqs are approved. jeff >