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

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

https://gcc.gnu.org/g:45b346664c0af57053e77276cd030015eb21f851

commit r12-9113-g45b346664c0af57053e77276cd030015eb21f851
Author: Siddhesh Poyarekar <siddh...@gotplt.org>
Date:   Thu Jan 26 07:07:03 2023 -0500

    tree-optimization/108522 Use component_ref_field_offset

    Instead of using TREE_OPERAND (expr, 2) directly, use
    component_ref_field_offset instead, which does scaling for us.  The
    function also substitutes PLACEHOLDER_EXPRs but it is not relevant for
    tree-object-size.

    gcc/ChangeLog:

            PR tree-optimization/108522
            * tree-object-size.cc (compute_object_offset): Make EXPR
            argument non-const.  Call component_ref_field_offset.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/108522
            * gcc.dg/builtin-dynamic-object-size-0.c (DEFSTRUCT): New
            macro.
            (test_dynarray_struct_member_b, test_dynarray_struct_member_c,
            test_dynarray_struct_member_d,
            test_dynarray_struct_member_subobj_b,
            test_dynarray_struct_member_subobj_c,
            test_dynarray_struct_member_subobj_d): New tests.
            (main): Call them.

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

Reply via email to