[PATCH] handle conditionals in -Wstringop-overflow et al. (PR 92936)

Martin Sebor msebor@gmail.com
Tue Nov 3 02:24:45 GMT 2020


The attached patch extends compute_objsize() to handle conditional
expressions represented either as PHIs or MIN_EXPR and MAX_EXPR.

To simplify the handling of the -Wstringop-overflow/-overread
warnings the change factors this code out of tree-ssa-strlen.c
and into inform_access() in builtins.c, making it a member of
access_ref.  Besides eliminating a decent amount of code
duplication this also improves the consistency of the warnings.

Finally, the change introduces a distinction between the definite
kinds of -Wstringop-overflow (and -Wstringop-overread) warnings
and the maybe kind.  The latter are currently only being issued
for function array parameters but I expect to make use of them
more extensively in the future.

Besides the usual GCC bootstrap/regtest I have tested the change
with Binutils/GDB and Glibc and verified that it doesn't introduce
any false positives.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-92936.diff
Type: text/x-patch
Size: 113519 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201102/287ee7bc/attachment-0001.bin>


More information about the Gcc-patches mailing list