aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-11-16 18:36:44 +0100
committerEric Botcazou <ebotcazou@adacore.com>2023-11-16 18:38:23 +0100
commit4d8b41bb0512947ce13636fc460ea9fb8dea419a (patch)
treeb1849828717df680f4b0c4fb3c494a8daf06f99e /gcc/ada/gcc-interface/decl.cc
parent23725aa53bd264941c4fb228227736be4da59761 (diff)
downloadgcc-4d8b41bb0512947ce13636fc460ea9fb8dea419a.zip
gcc-4d8b41bb0512947ce13636fc460ea9fb8dea419a.tar.gz
gcc-4d8b41bb0512947ce13636fc460ea9fb8dea419a.tar.bz2
Fix internal error on function returning dynamically-sized type
This is a tree sharing issue for the internal return type synthesized for a function returning a dynamically-sized type and taking an Out or In/Out parameter passed by copy. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Also create a TYPE_DECL for the return type built for the CI/CO mechanism. gcc/testsuite/ * gnat.dg/varsize4.ads, gnat.dg/varsize4.adb: New test. * gnat.dg/varsize4_pkg.ads: New helper.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.cc')
-rw-r--r--gcc/ada/gcc-interface/decl.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 95fa508..9c7f684 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -6329,6 +6329,12 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition,
if (debug_info_p)
rest_of_record_type_compilation (gnu_cico_return_type);
+
+ /* Declare it now since it will never be declared otherwise. This
+ is necessary to ensure that its subtrees are properly marked. */
+ create_type_decl (TYPE_NAME (gnu_cico_return_type),
+ gnu_cico_return_type,
+ true, debug_info_p, gnat_subprog);
}
gnu_return_type = gnu_cico_return_type;