Siddhesh Poyarekar <siddh...@gotplt.org> writes: > 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.
I could try play with https://github.com/siddhesh/fortify-metrics to see how much it happens in the wild if you can help me figure out a condition for when it punts (not tried). But I'm sceptical it's worth the time. Kees, you appeared on PR77608 -- was that because this came up in the kernel? > > 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(-)