diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -5094,7 +5094,8 @@ package body Checks is -- Don't deal with enumerated types with non-standard representation or else (Is_Enumeration_Type (Typ) - and then Present (Enum_Pos_To_Rep (Base_Type (Typ)))) + and then Present (Enum_Pos_To_Rep + (Implementation_Base_Type (Typ)))) -- Ignore type for which an error has been posted, since range in -- this case may well be a bogosity deriving from the error. Also diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -7103,7 +7103,10 @@ package body Exp_Attr is -- See separate sections below for the generated code in each case. when Attribute_Valid => Valid : declare - PBtyp : Entity_Id := Base_Type (Validated_View (Ptyp)); + PBtyp : Entity_Id := Implementation_Base_Type (Validated_View (Ptyp)); + pragma Assert (Is_Scalar_Type (PBtyp) + or else Serious_Errors_Detected > 0); + -- The scalar base type, looking through private types Save_Validity_Checks_On : constant Boolean := Validity_Checks_On;