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

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

https://gcc.gnu.org/g:2036765303869f5bdd72807ebde875e16e737935

commit r16-5663-g2036765303869f5bdd72807ebde875e16e737935
Author: Eric Botcazou <[email protected]>
Date:   Wed Nov 19 08:39:20 2025 +0100

    ada: Fix undefined reference with inline subprogram containing generic
instance

    The problem is that, for an inline subprogram declared in an instance, the
    cross-unit inlining machinery does not have the body by the time it decides
    to inline calls to the subprogram, because the instantiation of bodies is
    deferred until the end of the compilation.  So it cannot see whether this
    body contains excluded declarations or statements by that time, typically
    nested packages or instances thereof.

    The fix is to check that Is_Inlined is still set on the subprogram before
    passing it on to the back-end for cross-unit inlining.  It also removes an
    obsolete check that was done precisely there.

    This also adjusts the description of the -gnatwp switch, which can be used
    to get the reason why cross-inlining has failed, for example here:

    g.ads:4:01: warning: in instantiation at generic_si.adb:60 [-gnatwp]
    g.ads:4:01: warning: cannot inline "*" (nested package instantiation)

    gcc/ada/ChangeLog:

            PR ada/122574
            * doc/gnat_ugn/building_executable_programs_with_gnat.rst
(-gnatwp):
            Replace reference to -gnatN with -gnatn and adjust accordingly.
            * inline.adb: Remove clauses for Exp_Tss.
            (Has_Initialized_Type): Delete.
            (Add_Inlined_Subprogram): Test that the Is_Inlined flag is still
set
            on the subprogram.
            * usage.adb (Usage): Adjust description of -gnatwp.
            * gnat_ugn.texi: Regenerate.

Reply via email to