Extend the offset and size of merged object references [PR103215].
authorMartin Sebor <msebor@redhat.com>
Thu, 9 Dec 2021 19:49:28 +0000 (12:49 -0700)
committerMartin Sebor <msebor@redhat.com>
Thu, 9 Dec 2021 19:51:40 +0000 (12:51 -0700)
commit243a980437b5e7fca56587bf86667005bdf343a7
tree721ae4d4178055764fda459c742108017ed49371
parent9eeca99ccce4b56765920bd3c839abb77bbd4280
Extend the offset and size of merged object references [PR103215].

Resolves:
PR tree-optimization/103215 - bogus -Warray-bounds with two pointers with different offsets each

gcc/ChangeLog:

PR tree-optimization/103215
* pointer-query.cc (access_ref::merge_ref): Extend the offset and
size of the merged object instead of using the larger.

gcc/testsuite/ChangeLog:

PR tree-optimization/103215
* gcc.dg/Wstringop-overflow-58.c: Adjust and xfail expected warnings.
* gcc.dg/Wstringop-overflow-59.c: Same.
* gcc.dg/warn-strnlen-no-nul.c: Same.
* gcc.dg/Warray-bounds-91.c: New test.
* gcc.dg/Warray-bounds-92.c: New test.
* gcc.dg/Wstringop-overflow-85.c: New test.
* gcc.dg/Wstringop-overflow-87.c: New test.
gcc/pointer-query.cc
gcc/testsuite/gcc.dg/Warray-bounds-91.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Warray-bounds-92.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstringop-overflow-58.c
gcc/testsuite/gcc.dg/Wstringop-overflow-59.c
gcc/testsuite/gcc.dg/Wstringop-overflow-85.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstringop-overflow-87.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c