https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77622
Yuri Gribov <tetra2005 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |tetra2005 at gmail dot com --- Comment #1 from Yuri Gribov <tetra2005 at gmail dot com> --- Sounds like an important use-case. I did some basic debugging and it turns out that "&d[3] - 10" is represented as POINTER_PLUS_EXPR with (size_t)-10 offset. For some reason tree-object-size.c deliberately skips POINTER_PLUS_EXPRs with offset > offset_limit where offset_limit is (size_t)-1 / 2 so negative offsets are effectively ignored. Added Jakub to maybe comment on this behavior as that's his code.