Fix missing back-annotation for Out parameter
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 9 May 2020 20:26:25 +0000 (22:26 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 9 May 2020 20:26:25 +0000 (22:26 +0200)
This happens when it is passed by copy and not passed in.

* gcc-interface/decl.c (gnat_to_gnu_param): Also back-annotate the
mechanism in the case of an Out parameter only passed by copy-out.

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c

index 6fdb3f4a35e1ddb15407636222d4cf8ec776e563..20662be25c746ed93424119fc960732b1d394eb5 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-09  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_param): Also back-annotate the
+       mechanism in the case of an Out parameter only passed by copy-out.
+
 2020-05-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/gigi.h (change_qualified_type): Move around.
index 9c1acd9f23f4532debaf76bdf84cc6a6affa7e4f..ec9cc38a2c9a444d49ba45d3e81b2789b3e47bc9 100644 (file)
@@ -5447,7 +5447,10 @@ gnat_to_gnu_param (Entity_Id gnat_param, tree gnu_param_type, bool first,
       && (!type_requires_init_of_formal (Etype (gnat_param))
          || Is_Init_Proc (gnat_subprog)
          || by_return))
-    return gnu_param_type;
+    {
+      Set_Mechanism (gnat_param, By_Copy);
+      return gnu_param_type;
+    }
 
   gnu_param = create_param_decl (gnu_param_name, gnu_param_type);
   TREE_READONLY (gnu_param) = ro_param || by_ref || by_component_ptr;