To check validity of data values, we must strip privacy from their
types.
gcc/ada/
* checks.adb (Expr_Known_Valid): Use Validated_View, which strips
type derivation and privacy.
* exp_ch3.adb (Simple_Init_Private_Type): Kill checks inside
unchecked conversions, just like in Simple_Init_Scalar_Type.
----------------------
function Expr_Known_Valid (Expr : Node_Id) return Boolean is
- Typ : constant Entity_Id := Etype (Expr);
+ Typ : constant Entity_Id := Validated_View (Etype (Expr));
begin
-- Non-scalar types are always considered valid, since they never give
if Nkind (Expr) = N_Unchecked_Type_Conversion
and then Is_Scalar_Type (Under_Typ)
then
- Set_No_Truncation (Expr);
+ Set_Kill_Range_Check (Expr);
+ Set_No_Truncation (Expr);
end if;
return Expr;