[Ada] Lift restriction on renaming with Volatile_Full_Access
Arnaud Charlet
charlet@adacore.com
Tue May 26 13:44:00 GMT 2015
An arbitrary restriction was imposed on renaming in conjunction with the new
Aspect/Pragma Volatile_Full_Access for implementation reasons: the compiler
was rejecting renamings of components of Volatile_Full_Access objects.
It is lifted by this change and the following package must now be accepted:
package RenamVFA is
type Int8_t is mod 2**8;
type Rec is record
A,B,C,D : Int8_t;
end record;
for Rec'Size use 32;
for Rec'Alignment use 4;
pragma Volatile_Full_Access (Rec);
R : Rec;
I1 : Int8_t renames R.A;
type Arr is array (1 .. 4) of Int8_t;
pragma Volatile_Full_Access (Arr);
A : Arr;
I2 : Int8_t renames A (1);
end RenamVFA;
Tested on x86_64-pc-linux-gnu, committed on trunk
2015-05-26 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch8.adb (Analyze_Object_Renaming): Lift restriction on
components of Volatile_Full_Access objects.
-------------- next part --------------
Index: sem_ch8.adb
===================================================================
--- sem_ch8.adb (revision 223685)
+++ sem_ch8.adb (working copy)
@@ -927,25 +927,6 @@
("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 Is_Volatile_Full_Access (Entity (P))
- or else
- Is_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,
More information about the Gcc-patches
mailing list