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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |16.0

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
https://gcc.gnu.org/g:7fd14b6c9d191a715303a4dae3d25706131aed13

commit r16-5903-g7fd14b6c9d191a715303a4dae3d25706131aed13
Author: Denis Mazzucato <[email protected]>
Date:   Wed Sep 24 17:25:39 2025 +0200

   ada: Fix reducer selection when resolving 'Reduce attribute

   This patch ensures that, during the 'Reduce attribute resolution phase, the
   selected reducer subprogram exists, is not ambiguous, and has the proper
   reducer profile. Before we could have selected a wrong interpretation.

    gcc/ada/ChangeLog:

        * sem_attr.adb
        (Analyze_Attribute): Set the type of the attribute expression only when
        not ambiguous (it will later be resolved correctly). Emit an error in
        case the type is limited.
        (Resolve_Attribute): Emit an error if the reducer has no entity.
        (Get_Value_Subtype): Try to resolve the Value_Subtype of the aggregate
        expression, and if it succeeds, set the candidate reducer subprogram.
        (Is_Reducer_Subprogram): Check whether the selected candidate has a
        proper reducer profile.
        (Make_Array_Type): Return simple array type to resolve the array
        aggregate against it.
        (Resolve_Attribute): Reimplement the resolution of Reduce attribute,
        including its prefix.
        * sem_res.adb (Resolve_Declare_Expression): Save and restore variables
        that may be hidden by the local declaration. Only setting the new
        entities is problematic when dealing with copied trees where the ref is
        lost (eg. when resolving array aggregates).
        * exp_attr.adb (Expand_N_Attribute_Reference): Remove tricks to resolve
        the reducer in case of faulty resolution as not needed anymore.

    gcc/testsuite/ChangeLog:

            * gnat.dg/reduce1.adb: Adjust expected error message.

Reply via email to