https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120780

--- Comment #23 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Siddhesh Poyarekar
<siddh...@gcc.gnu.org>:

https://gcc.gnu.org/g:63c4d4f59a92007c6d0f35e4d7aa1a97691306db

commit r15-9948-g63c4d4f59a92007c6d0f35e4d7aa1a97691306db
Author: Siddhesh Poyarekar <siddh...@gotplt.org>
Date:   Thu Jun 26 17:46:00 2025 -0400

    tree-optimization/120780: Support object size for containing objects

    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.

    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.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/120780
            * gcc.dg/builtin-dynamic-object-size-pr120780.c: New test case.

    Signed-off-by: Siddhesh Poyarekar <siddh...@gotplt.org>
    (cherry picked from commit 72e85d46472716e670cbe6e967109473b8d12d38)

Reply via email to