]> git.ipfire.org Git - thirdparty/gcc.git/commit
Correct stpcpy offset computation for -Warray-bounds et al. [PR101397].
authorMartin Sebor <msebor@redhat.com>
Tue, 20 Jul 2021 19:48:20 +0000 (13:48 -0600)
committerMartin Sebor <msebor@redhat.com>
Tue, 20 Jul 2021 19:50:16 +0000 (13:50 -0600)
commit8bf5b49ebd2176b8c535147377381dd07fbdd643
tree49d02a88e682cbc77d10e2ba584658f6a26c4bb5
parent124eaa50e0a34f5f89572c1aa812c50979da58fc
Correct stpcpy offset computation for -Warray-bounds et al. [PR101397].

Resolves:
PR middle-end/101397 - spurious warning writing to the result of stpcpy minus 1

gcc/ChangeLog:

PR middle-end/101397
* builtins.c (gimple_call_return_array): Add argument.  Correct
offsets for memchr, mempcpy, stpcpy, and stpncpy.
(compute_objsize_r): Adjust offset computation for argument returning
built-ins.

gcc/testsuite/ChangeLog:

PR middle-end/101397
* gcc.dg/Warray-bounds-80.c: New test.
* gcc.dg/Warray-bounds-81.c: New test.
* gcc.dg/Warray-bounds-82.c: New test.
* gcc.dg/Warray-bounds-83.c: New test.
* gcc.dg/Warray-bounds-84.c: New test.
* gcc.dg/Wstringop-overflow-46.c: Adjust expected output.
gcc/builtins.c
gcc/testsuite/gcc.dg/Warray-bounds-80.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Warray-bounds-81.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Warray-bounds-82.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Warray-bounds-83.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Warray-bounds-84.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstringop-overflow-46.c