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

--- Comment #8 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:9e10fc177be25e5430e72a5c55ce7a36c45562c3

commit r16-4664-g9e10fc177be25e5430e72a5c55ce7a36c45562c3
Author: Eric Botcazou <[email protected]>
Date:   Mon Oct 27 19:10:49 2025 +0100

    Ada: Fix visibility problem for implicit actual of formal subprogram

    If an actual parameter for a formal subprogram parameter of a generic unit,
    whose default is specified by a box, is omitted then an implicit actual
with
    the name of the formal is used and resolved in the context of the instance.

    If this context is a generic unit, and these implicit actuals are resolved
    to global references, then these implicit actuals need to be retrofitted
    into the unanalyzed copy of the generic unit, so that instances of this
    generic unit do not resolve again the implicit actuals but inherit the
    global references instead.

    This works fine for instances whose name is a direct name but not for those
    whose name is an expanded name (in GNAT parlance).  The patch also contains
    a small cleanup for a related procedure.

    gcc/ada/
            PR ada/25988
            * sem_ch12.adb (Save_Global_References.Reset_Entity): Also call
            Save_Global_Defaults for instances with an expanded name.
            (Save_Global_References.Save_References): Minor code cleanup.

    gcc/testsuite/
            * gnat.dg/specs/generic_inst3.ads: New test.
            * gnat.dg/specs/generic_inst3_pkg1.ads: New helper.
            * gnat.dg/specs/generic_inst3_pkg1.adb: New helper.
            * gnat.dg/specs/generic_inst3_pkg2.ads: Likewise.
            * gnat.dg/specs/generic_inst3_pkg3.ads: Likewise.
            * gnat.dg/specs/generic_inst3_pkg3-child.ads: Likewise.

Reply via email to