diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-04-21 10:57:30 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-04-21 10:57:30 +0200 |
commit | 9b7924dd177330167865a83f5696a9ae34554972 (patch) | |
tree | e6df3b6071ce3b9eab7023eaa8fbbbd5ce15c051 /gcc/ada/exp_ch6.adb | |
parent | d74716b313b967b8a9406d86bae41d8843180505 (diff) | |
download | gcc-9b7924dd177330167865a83f5696a9ae34554972.zip gcc-9b7924dd177330167865a83f5696a9ae34554972.tar.gz gcc-9b7924dd177330167865a83f5696a9ae34554972.tar.bz2 |
[multiple changes]
2016-04-21 Eric Botcazou <ebotcazou@adacore.com>
* gnatlink.adb (Gnatlink): Robustify detection of Windows target.
* alloc.ads: Minor comment fixes.
* einfo.ads: Fix typo.
2016-04-21 Arnaud Charlet <charlet@adacore.com>
* exp_aggr.adb (Component_Not_OK_For_Backend): Redo previous
changes to handle all cases of components depending on the
discriminant, not just string literals.
2016-04-21 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Analyze_Subtype_Declaration): If the subtype
declaration is the generated declaration for a generic actual,
inherit predicates from the actual if it is a predicated subtype.
2016-04-21 Ed Schonberg <schonberg@adacore.com>
* exp_ch6.adb (Rewrite_Function_Call_For_C): If the function is
inherited and its result is controlling, introduce a conversion
on the actual for the corresponding procedure call, to avoid
spurious type errors.
2016-04-21 Jerome Lambourg <lambourg@adacore.com>
* krunch.adb (Krunch): Fix krunching of i-vxworks.
From-SVN: r235317
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 162849e..599e462 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -8432,11 +8432,13 @@ package body Exp_Ch6 is -- Local variables - Func_Id : constant Entity_Id := Ultimate_Alias (Entity (Name (N))); + Orig_Func : constant Entity_Id := Entity (Name (N)); + Func_Id : constant Entity_Id := Ultimate_Alias (Orig_Func); Par : constant Node_Id := Parent (N); Proc_Id : constant Entity_Id := Rewritten_For_C_Proc_Id (Func_Id); Loc : constant Source_Ptr := Sloc (Par); Actuals : List_Id; + Last_Actual : Node_Id; Last_Formal : Entity_Id; -- Start of processing for Rewrite_Function_Call_For_C @@ -8467,12 +8469,23 @@ package body Exp_Ch6 is -- Proc_Call (..., LHS); + -- If function is inherited, a conversion may be necessary. + if Nkind (Par) = N_Assignment_Statement then + Last_Actual := Name (Par); + + if not Comes_From_Source (Orig_Func) + and then Etype (Orig_Func) /= Etype (Func_Id) + then + Last_Actual := + Unchecked_Convert_To (Etype (Func_Id), Last_Actual); + end if; + Append_To (Actuals, Make_Parameter_Association (Loc, Selector_Name => Make_Identifier (Loc, Chars (Last_Formal)), - Explicit_Actual_Parameter => Name (Par))); + Explicit_Actual_Parameter => Last_Actual)); Rewrite (Par, Make_Procedure_Call_Statement (Loc, |