https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org

--- Comment #31 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> We talked about backporting the patches to GCC 10 with Richi on IRC today
> and decided to wait for potential fallout even if we miss the 10.3 release.

The fallout is major in Ada for the return part because the logic completely
overlooks the CALL_EXPR_RETURN_SLOT_OPT flag; when it is set, you don't need to
create a variable in the caller when inlining the function, so this works:

procedure Inline22 (L, U : Integer) is

  type Arr is array (Integer range L .. U) of Boolean;

  function Get_Zero return Arr;
  pragma Inline_Always (Get_Zero);

  function Get_Zero return Arr is
  begin
    return (others => False);
  end;

  A : Arr;

begin
  A := Get_Zero;
end;

eric@fomalhaut:~/install/gcc-10/bin/gcc -c inline22.adb 
eric@fomalhaut:~/install/gcc-11/bin/gcc -c inline22.adb 
inline22.adb: In function 'Inline22.Get_Zero':
inline22.adb:10:3: error: function 'Inline22.Get_Zero' can never be inlined
because it has a VLA return argument

Reply via email to