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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eric Botcazou <[email protected]>:

https://gcc.gnu.org/g:8836210fb62058980aeb02d6aad7f6dbca87b50b

commit r16-5033-g8836210fb62058980aeb02d6aad7f6dbca87b50b
Author: Eric Botcazou <[email protected]>
Date:   Tue Nov 4 19:54:45 2025 +0100

    Ada: Fix incorrect legality check in instantiation of child generic unit

    The problem arises when the generic unit has a formal access type
parameter,
    because the manual resolution implemented in Find_Actual_Type does not pick
    the correct entity for the designated type.  The fix replaces it with a
bona
    fide resolution and cleans up the associated code in the callers.

    gcc/ada/
            PR ada/18453
            * sem_ch12.adb (Find_Actual_Type): Add Typ_Ref parameter and
            perform a standard resolution on it in the fallback case.
            Call Get_Instance_Of if the type is declared in a formal of
            the child unit.
            (Instantiate_Type.Validate_Access_Type_Instance): Adjust call
            to Find_Actual_Type.
            (Instantiate_Type.Validate_Array_Type_Instance): Likewise and
            streamline the check for matching component subtypes.

    gcc/testsuite/
            * gnat.dg/specs/generic_inst9.ads: New test.
            * gnat.dg/specs/generic_inst9_pkg1.ads: New helper.
            * gnat.dg/specs/generic_inst9_pkg2.ads: Likewise.
            * gnat.dg/specs/generic_inst9_pkg2-g.ads: Likewise.
  • [Bug ada/18453] incorrect legal... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to