[Bug ada/124923] internal error on private tagged types in instance with -gnateV

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 4 08:45:57 GMT 2026


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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marc Poulhies <dkm@gcc.gnu.org>:

https://gcc.gnu.org/g:82951a86c754cd7f8421783b6edaffc61a5e2119

commit r17-1289-g82951a86c754cd7f8421783b6edaffc61a5e2119
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Sat May 2 11:09:18 2026 +0200

    ada: Fix internal error on private tagged types in instance with -gnateV

    The problem is that the full view of a private tagged type, which is
visible
    in the generic unit, is not restored when expanding -gnateV in the
instance.

    The fix uses a two-pronged approach:

      1. the Valid_Scalars attribute, on which -gnateV is piggybacked, is fixed
         to properly handle tagged extensions (only the components declared in
         the root type are currently tested for validity).

      2. the special case for tagged extensions in instance bodies implemented
         by Try_Selected_Component_In_Instance is extended to whole instances.

    gcc/ada/ChangeLog:

            PR ada/124923
            * exp_attr.adb (Build_Record_VS_Func): Rename first parameter, fix
            description and implement support for tagged extensions.
            (Expand_N_Attribute_Reference) <Attribute_Valid_Scalars>: Also bail
            out for the class-wide type of private tagged types and Adjust call
            to Build_Record_VS_Func.
            * sem_attr.adb (Analyze_Attribute) <Attribute_Valid_Scalars>: Also
            warn for the class-wide type of private tagged types.
            * sem_ch4.adb (Try_Selected_Component_In_Instance): Extend a
special
            case from instance bodies to whole instances.
            * sem_util.ads (Validated_View): Adjust description.
            * sem_util.adb (Validated_View): Do not recurse on the parent type
            for tagged extensions.


More information about the Gcc-bugs mailing list