[Ada] Adding support for unsupported type conversions in CCG
authorJavier Miranda <miranda@adacore.com>
Fri, 13 Dec 2019 09:05:08 +0000 (09:05 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Fri, 13 Dec 2019 09:05:08 +0000 (09:05 +0000)
2019-12-13  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* exp_unst.adb (Unnest_Subprogram): Generate an extra temporary
to facilitate the C backend processing dereferences.

From-SVN: r279361

gcc/ada/ChangeLog
gcc/ada/exp_unst.adb

index d135da8c1e737479a125dafc6771b39177ccec78..0f58e098a61e1983af926af59d5669700e3a6eb5 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-13  Javier Miranda  <miranda@adacore.com>
+
+       * exp_unst.adb (Unnest_Subprogram): Generate an extra temporary
+       to facilitate the C backend processing dereferences.
+
 2019-12-13  Javier Miranda  <miranda@adacore.com>
 
        * sem_prag.adb (Analyze_Pragma): Propagate the
index 5347a7f99b42c3b2f2b4111bd44089b9480a47a7..f016d2f4d4991738a5dd37cc574a4ca77e0b4055 100644 (file)
@@ -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;