On 2025-07-03 03:13, Jakub Jelinek wrote:
On Thu, Jul 03, 2025 at 08:33:45AM +0200, Richard Biener wrote:
On Wed, Jul 2, 2025 at 11:32 PM Siddhesh Poyarekar <siddh...@gotplt.org> wrote:

MEM_REF cast of a subobject to its containing object has negative
offsets, which objsz sees as an invalid access.  Support this use case
by peeking into the structure to validate that the containing object
indeed contains a type of the subobject at that offset and if present,
adjust the wholesize for the object to allow the negative offset.

This variant works for me.

gcc/ChangeLog:

         PR tree-optimization/120780
         * tree-object-size.cc (inner_at_offset,
         get_wholesize_for_memref): New functions.
         (addr_object_size): Call GET_WHOLESIZE_FOR_MEMREF.

Please no caps in function names in the ChangeLog, sometimes it
is used for parameter names, but never saw it for functions.

Ack, I'll fix it up before committing. I'll also backport to the gcc15 branch in a couple of days, giving post-commit CIs a chance to identify any potential issues before I do that.

Thanks both!

Sid

Reply via email to