From: Arnaud Charlet Date: Thu, 11 Apr 2013 10:22:08 +0000 (+0200) Subject: [multiple changes] X-Git-Tag: releases/gcc-4.9.0~6544 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=294f5d825fc452692fda912a5ede6945c91f8ecd;p=thirdparty%2Fgcc.git [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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0ed467beb5e0..3a4a43a21787 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 7fcad755bf9c..6a392e5de046 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 8381837a0507..132dd0ce2f71 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",