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

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
https://gcc.gnu.org/g:45131b851522180c532bebb3521865e488025af0

commit r15-4143-g45131b851522180c532bebb3521865e488025af0
Author: Eric Botcazou <ebotca...@adacore.com>
Date:   Thu Sep 5 00:19:25 2024 +0200

    ada: Fix wrong finalization of anonymous array aggregate

    The issue arises when the aggregate consists only of iterated associations
    because, in this case, its expansion uses a 2-pass mechanism which creates
    a temporary that needs a fully-fledged initialization, thus running afoul
    of the optimization that avoids building the initialization procedure in
    the anonymous array case.

    gcc/ada/ChangeLog:
            * exp_aggr.ads (Is_Two_Pass_Aggregate): New function declaration.
            * exp_aggr.adb (Is_Two_Pass_Aggregate): New function body.
            (Expand_Array_Aggregate): Call Is_Two_Pass_Aggregate to detect the
            aggregates that need the 2-pass expansion.
            * exp_ch3.adb (Expand_Freeze_Array_Type): In the anonymous array
            case, build the initialization procedure if the initial value in
            the object declaration is a 2-pass aggregate.

Reply via email to