From 3af796b550ebadbdba31dccea948b52fad7287dc Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Fri, 13 Dec 2019 09:05:08 +0000 Subject: [PATCH] [Ada] Adding support for unsupported type conversions in CCG 2019-12-13 Javier Miranda gcc/ada/ * exp_unst.adb (Unnest_Subprogram): Generate an extra temporary to facilitate the C backend processing dereferences. From-SVN: r279361 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/exp_unst.adb | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d135da8c1e7..0f58e098a61 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-12-13 Javier Miranda + + * exp_unst.adb (Unnest_Subprogram): Generate an extra temporary + to facilitate the C backend processing dereferences. + 2019-12-13 Javier Miranda * sem_prag.adb (Analyze_Pragma): Propagate the diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index 5347a7f99b4..f016d2f4d49 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -27,6 +27,7 @@ with Atree; use Atree; with Debug; use Debug; with Einfo; use Einfo; with Elists; use Elists; +with Exp_Util; use Exp_Util; with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; @@ -2345,6 +2346,18 @@ package body Exp_Unst is -- expect any exceptions) Analyze_And_Resolve (UPJ.Ref, Typ, Suppress => All_Checks); + + -- Generate an extra temporary to facilitate the C backend + -- processing this dereference + + if Opt.Modify_Tree_For_C + and then Nkind_In (Parent (UPJ.Ref), + N_Type_Conversion, + N_Unchecked_Type_Conversion) + then + Force_Evaluation (UPJ.Ref, Mode => Strict); + end if; + Pop_Scope; end Rewrite_One_Ref; end; -- 2.30.2