diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-04-27 14:55:18 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-04-27 14:55:18 +0200 |
commit | db99c46e1d6d3ae3323d0e5ae1dc739291af7143 (patch) | |
tree | 3b852b556143ed9a1fe9a1f0c8a1c04e811bffd3 /gcc/ada/exp_ch6.adb | |
parent | c6c8d059421efe3d025483c11c66941a8d1926a4 (diff) | |
download | gcc-db99c46e1d6d3ae3323d0e5ae1dc739291af7143.zip gcc-db99c46e1d6d3ae3323d0e5ae1dc739291af7143.tar.gz gcc-db99c46e1d6d3ae3323d0e5ae1dc739291af7143.tar.bz2 |
[multiple changes]
2016-04-27 Bob Duff <duff@adacore.com>
* a-coinve.adb, a-comutr.adb, a-conhel.adb, a-convec.adb,
exp_util.adb: Remove assertions that can fail in obscure cases when
assertions are turned on but tampering checks are turned off.
2016-04-27 Javier Miranda <miranda@adacore.com>
* exp_ch6.adb (Add_Call_By_Copy_Code,
Add_Simple_Call_By_Copy_Code, Expand_Actuals): Handle formals
whose type comes from the limited view.
2016-04-27 Yannick Moy <moy@adacore.com>
* a-textio.adb: Complete previous patch.
2016-04-27 Yannick Moy <moy@adacore.com>
* inline.adb (Expand_Inlined_Call): Use Cannot_Inline instead of
Error_Msg_N to issue message about impossibility to inline call,
with slight change of message.
2016-04-27 Hristian Kirtchev <kirtchev@adacore.com>
* exp_spark.adb (Expand_Potential_Renaming): Removed.
(Expand_SPARK): Update the call to expand a potential renaming.
(Expand_SPARK_Potential_Renaming): New routine.
* exp_spark.ads (Expand_SPARK_Potential_Renaming): New routine.
* sem.adb Add with and use clauses for Exp_SPARK.
(Analyze): Expand a non-overloaded potential renaming for SPARK.
2016-04-27 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Constrain_Discriminated_Type): In an instance,
check full view for the presence of defaulted discriminants,
even when the partial view of a private type has no visible and
no unknown discriminants.
From-SVN: r235497
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 1d3ab7d..c34f17d 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -1198,14 +1198,14 @@ package body Exp_Ch6 is --------------------------- procedure Add_Call_By_Copy_Code is + Crep : Boolean; Expr : Node_Id; + F_Typ : Entity_Id := Etype (Formal); + Indic : Node_Id; Init : Node_Id; Temp : Entity_Id; - Indic : Node_Id; - Var : Entity_Id; - F_Typ : constant Entity_Id := Etype (Formal); V_Typ : Entity_Id; - Crep : Boolean; + Var : Entity_Id; begin if not Is_Legal_Copy then @@ -1214,6 +1214,14 @@ package body Exp_Ch6 is Temp := Make_Temporary (Loc, 'T', Actual); + -- Handle formals whose type comes from the limited view + + if From_Limited_With (F_Typ) + and then Has_Non_Limited_View (F_Typ) + then + F_Typ := Non_Limited_View (F_Typ); + end if; + -- Use formal type for temp, unless formal type is an unconstrained -- array, in which case we don't have to worry about bounds checks, -- and we use the actual type, since that has appropriate bounds. @@ -1221,7 +1229,7 @@ package body Exp_Ch6 is if Is_Array_Type (F_Typ) and then not Is_Constrained (F_Typ) then Indic := New_Occurrence_Of (Etype (Actual), Loc); else - Indic := New_Occurrence_Of (Etype (Formal), Loc); + Indic := New_Occurrence_Of (F_Typ, Loc); end if; if Nkind (Actual) = N_Type_Conversion then @@ -1473,20 +1481,28 @@ package body Exp_Ch6 is ---------------------------------- procedure Add_Simple_Call_By_Copy_Code is - Temp : Entity_Id; Decl : Node_Id; + F_Typ : Entity_Id := Etype (Formal); Incod : Node_Id; - Outcod : Node_Id; + Indic : Node_Id; Lhs : Node_Id; + Outcod : Node_Id; Rhs : Node_Id; - Indic : Node_Id; - F_Typ : constant Entity_Id := Etype (Formal); + Temp : Entity_Id; begin if not Is_Legal_Copy then return; end if; + -- Handle formals whose type comes from the limited view + + if From_Limited_With (F_Typ) + and then Has_Non_Limited_View (F_Typ) + then + F_Typ := Non_Limited_View (F_Typ); + end if; + -- Use formal type for temp, unless formal type is an unconstrained -- array, in which case we don't have to worry about bounds checks, -- and we use the actual type, since that has appropriate bounds. @@ -1494,7 +1510,7 @@ package body Exp_Ch6 is if Is_Array_Type (F_Typ) and then not Is_Constrained (F_Typ) then Indic := New_Occurrence_Of (Etype (Actual), Loc); else - Indic := New_Occurrence_Of (Etype (Formal), Loc); + Indic := New_Occurrence_Of (F_Typ, Loc); end if; -- Prepare to generate code @@ -1517,7 +1533,7 @@ package body Exp_Ch6 is if Ekind (Formal) = E_Out_Parameter then Incod := Empty; - if Has_Discriminants (Etype (Formal)) then + if Has_Discriminants (F_Typ) then Indic := New_Occurrence_Of (Etype (Actual), Loc); end if; @@ -1719,6 +1735,14 @@ package body Exp_Ch6 is E_Formal := Etype (Formal); E_Actual := Etype (Actual); + -- Handle formals whose type comes from the limited view + + if From_Limited_With (E_Formal) + and then Has_Non_Limited_View (E_Formal) + then + E_Formal := Non_Limited_View (E_Formal); + end if; + if Is_Scalar_Type (E_Formal) or else Nkind (Actual) = N_Slice then |