Expansion of attribute Valid_Scalars was meant to use Get_Fullest_View
for arrays and Validated_View for records. However, this was not done
consistently and for records we were mixing Get_Fullest_View with
Validated_View.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * exp_attr.adb (Expand_N_Attribute_Reference): Explicitly use
        Validated_View for record objects.
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
@@ -7460,7 +7460,7 @@ package body Exp_Attr is
                     (Build_Record_VS_Func
                       (Attr       => N,
                        Formal_Typ => Ptyp,
-                       Rec_Typ    => Val_Typ),
+                       Rec_Typ    => Validated_View (Ptyp)),
                     Loc),
                 Parameter_Associations => New_List (Pref));
          end if;


Reply via email to