https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109881
--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- https://gcc.gnu.org/g:c5e1cb7e501350ea339db44ca5a33704d817a6fb commit r13-8075-gc5e1cb7e501350ea339db44ca5a33704d817a6fb Author: Eric Botcazou <ebotca...@adacore.com> Date: Thu Nov 16 18:36:44 2023 +0100 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.