This series makes a few improvements to get static object size estimates in more cases, thus improving the success rate of the static __builtin_object_size. This should fully fix PR116556 and also covers a bulk of use cases for PR77608. I started to try and fix PR77608 fully, but in the end it looks like too much work in the pass for what seems like a very small set of uses, i.e. handling volatile offsets. If that is a desirable end goal then it could be done in a separate patchset since it will need tree-object-size to handle trees with side-effects.
Testing: - x86_64 bootstrap and make-check did not introduce any new regressions - i686 build and make-check did not introduce any new regressions - Bootstrap build with bootstrap-ubsan config succeeded. Thanks, Sid Siddhesh Poyarekar (4): tree-object-size: use size_for_offset in more cases tree-object-size: Fold PHI node offsets with constants [PR116556] tree-object-size: Handle PHI + CST type offsets tree-object-size: Fall back to wholesize for non-const offset gcc/testsuite/gcc.dg/builtin-object-size-1.c | 102 +++++++++++++++++++ gcc/testsuite/gcc.dg/builtin-object-size-3.c | 89 +++++++++++++++- gcc/testsuite/gcc.dg/builtin-object-size-4.c | 6 +- gcc/tree-object-size.cc | 101 +++++++++++++++++- 4 files changed, 289 insertions(+), 9 deletions(-) -- 2.45.1