It is not allowed to rename a component of a composite object to which pragma Volatile_Full_Access has been applied. The following is compiled with -gnatj55
1. package RenamVFA is 2. type Int8_t is mod 2**8; 3. type Rec is record 4. A,B,C,D : Int8_t; 5. end record; 6. for Rec'Size use 32; 7. for Rec'Alignment use 4; 8. pragma Volatile_Full_Access (Rec); 9. R : Rec; 10. I1 : Int8_t renames R.A; -- illegal for now | >>> cannot rename component of Volatile_Full_Access object 11. type Arr is array (1 .. 4) of Int8_t; 12. pragma Volatile_Full_Access (Arr); 13. A : Arr; 14. I2 : Int8_t renames A (1); -- illegal for now | >>> cannot rename component of Volatile_Full_Access object 15. end RenamVFA; Tested on x86_64-pc-linux-gnu, committed on trunk 2015-05-22 Robert Dewar <de...@adacore.com> * sem_ch8.adb (Analyze_Object_Renaming): Check for renaming component of an object to which Volatile_Full_Access applies.
Index: sem_ch8.adb =================================================================== --- sem_ch8.adb (revision 223541) +++ sem_ch8.adb (working copy) @@ -912,6 +912,25 @@ ("renaming of conversion only allowed for tagged types", Nam); end if; + -- Reject renaming of component of Volatile_Full_Access object + + if Nkind_In (Nam, N_Selected_Component, N_Indexed_Component) then + declare + P : constant Node_Id := Prefix (Nam); + begin + if Is_Entity_Name (P) then + if Has_Volatile_Full_Access (Entity (P)) + or else + Has_Volatile_Full_Access (Etype (P)) + then + Error_Msg_N + ("cannot rename component of Volatile_Full_Access " + & "object", Nam); + end if; + end if; + end; + end if; + Resolve (Nam, T); -- If the renamed object is a function call of a limited type,