]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Plug loophole for built-in-place return with limited_with clause
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 23 May 2022 23:14:18 +0000 (01:14 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 4 Jul 2022 07:45:51 +0000 (07:45 +0000)
When the result type of a function requiring built-in-place return is
only visible through a limited_with clause, the compiled needs to wait
for the nonlimited view to be available in order to compute whether
the built-in-place return is needed, and this comprises tagging the
function with the Returns_By_Ref flag.

gcc/ada/

* exp_ch6.adb (Build_In_Place_Formal): Also compute Returns_By_Ref
for the function if the extra formals were not built initially.

gcc/ada/exp_ch6.adb

index 15a20392457dc7b3689228d6bf03a4b507b1415a..88157b946ea8fd141470bce876569579dd479580 100644 (file)
@@ -850,11 +850,12 @@ package body Exp_Ch6 is
       --  The return type in the function declaration may have been a limited
       --  view, and the extra formals for the function were not generated at
       --  that point. At the point of call the full view must be available and
-      --  the extra formals can be created.
+      --  the extra formals can be created and Returns_By_Ref computed.
 
       if No (Extra_Formal) then
          Create_Extra_Formals (Func);
          Extra_Formal := Extra_Formals (Func);
+         Compute_Returns_By_Ref (Func);
       end if;
 
       --  We search for a formal with a matching suffix. We can't search