[gcc/devel/ranger] Fix missing back-annotation for Out parameter

Aldy Hernandez aldyh@gcc.gnu.org
Wed Jun 17 21:16:04 GMT 2020


https://gcc.gnu.org/g:40bd5a536257aabc0f3899d661debc13dee18d75

commit 40bd5a536257aabc0f3899d661debc13dee18d75
Author: Eric Botcazou <ebotcazou@gcc.gnu.org>
Date:   Sat May 9 22:26:25 2020 +0200

    Fix missing back-annotation for Out parameter
    
    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.

Diff:
---
 gcc/ada/ChangeLog            | 5 +++++
 gcc/ada/gcc-interface/decl.c | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6fdb3f4a35e..20662be25c7 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 9c1acd9f23f..ec9cc38a2c9 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -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;


More information about the Gcc-cvs mailing list