[gcc/devel/gccgo] Small tweak to gnat_to_gnu_param

Ian Lance Taylor ian@gcc.gnu.org
Sun Jul 12 18:00:13 GMT 2020


https://gcc.gnu.org/g:db4062a0cbe00ce4075a4d7f68a2ff15165cd72b

commit db4062a0cbe00ce4075a4d7f68a2ff15165cd72b
Author: Eric Botcazou <ebotcazou@gcc.gnu.org>
Date:   Fri May 8 16:36:53 2020 +0200

    Small tweak to gnat_to_gnu_param
    
    We mark the type of In parameters in Ada with the const qualifier, but
    it is stripped by free_lang_data_in_type so do not do it in LTO mode.
    
            * gcc-interface/decl.c (gnat_to_gnu_param): Do not make a variant
            of the type in LTO mode.

Diff:
---
 gcc/ada/ChangeLog            | 5 +++++
 gcc/ada/gcc-interface/decl.c | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index eacc976e14b..329234f4e7f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* gcc-interface/decl.c (gnat_to_gnu_param): Do not make a variant of
+	the type in LTO mode.
+
 2020-05-04  Mikael Pettersson  <mikpelinux@gmail.com>
 
 	PR bootstrap/94918
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 80dfc55b601..3cd9d521503 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -5327,9 +5327,12 @@ gnat_to_gnu_param (Entity_Id gnat_param, tree gnu_param_type, bool first,
     }
 
   /* If this is a read-only parameter, make a variant of the type that is
-     read-only.  ??? However, if this is a self-referential type, the type
+     read-only, except in LTO mode because free_lang_data_in_type would
+     undo it.  ??? However, if this is a self-referential type, the type
      can be very complex, so skip it for now.  */
-  if (ro_param && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_param_type)))
+  if (ro_param
+      && !flag_generate_lto
+      && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_param_type)))
     gnu_param_type = change_qualified_type (gnu_param_type, TYPE_QUAL_CONST);
 
   /* For foreign conventions, pass arrays as pointers to the element type.


More information about the Gcc-cvs mailing list