From 294f5d825fc452692fda912a5ede6945c91f8ecd Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 11 Apr 2013 12:22:08 +0200 Subject: [PATCH] [multiple changes] 2013-04-11 Hristian Kirtchev * exp_ch4.adb (Process_Transient_Object): Use an unchecked conversion when associating a transient controlled object with its "hook". 2013-04-11 Ed Schonberg * sem_prag.adb (Analyze_Pragma, case Preelaborable_Initialization): The pragma is legal if it comes from an aspect on the private view of the type, even though its analysis point takes place later at the freeze point. From-SVN: r197760 --- gcc/ada/ChangeLog | 13 +++++++++++++ gcc/ada/exp_ch4.adb | 5 ++++- gcc/ada/sem_prag.adb | 20 +++++++++++++++----- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0ed467beb5e..3a4a43a2178 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2013-04-11 Hristian Kirtchev + + * exp_ch4.adb (Process_Transient_Object): Use + an unchecked conversion when associating a transient controlled + object with its "hook". + +2013-04-11 Ed Schonberg + + * sem_prag.adb (Analyze_Pragma, case + Preelaborable_Initialization): The pragma is legal if it comes + from an aspect on the private view of the type, even though its + analysis point takes place later at the freeze point. + 2013-04-11 Robert Dewar * sem_ch6.adb: Minor reformatting. diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 7fcad755bf9..6a392e5de04 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -5246,7 +5246,10 @@ package body Exp_Ch4 is -- Step 3: Hook the transient object to the temporary if Is_Access_Type (Obj_Typ) then - Expr := Convert_To (Ptr_Id, New_Reference_To (Obj_Id, Loc)); + + -- Why is this an unchecked conversion ??? + Expr := + Unchecked_Convert_To (Ptr_Id, New_Reference_To (Obj_Id, Loc)); else Expr := Make_Attribute_Reference (Loc, diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 8381837a050..132dd0ce2f7 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -13423,12 +13423,22 @@ package body Sem_Prag is Check_First_Subtype (Arg1); Ent := Entity (Get_Pragma_Arg (Arg1)); - if not (Is_Private_Type (Ent) - or else - Is_Protected_Type (Ent) - or else - (Is_Generic_Type (Ent) and then Is_Derived_Type (Ent))) + -- The pragma may come from an aspect on a private declaration, + -- even if the freeze point at which this is analyzed in the + -- private part after the full view. + + if Has_Private_Declaration (Ent) + and then From_Aspect_Specification (N) + then + null; + + elsif Is_Private_Type (Ent) + or else Is_Protected_Type (Ent) + or else (Is_Generic_Type (Ent) and then Is_Derived_Type (Ent)) then + null; + + else Error_Pragma_Arg ("pragma % can only be applied to private, formal derived or " & "protected type", -- 2.30.2