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

--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Note that the testcase also raises Storage_Error with:

  function Foo (J : Integer) return Integer;
  pragma Pure_Function (Foo);
  pragma Machine_Attribute (Foo, "noipa");

and in Ada calls to pure functions are allowed to be elided if their result is
not used, independently of whether they may raise an exception, so we
effectively end up with something like:

  function Bar (A : access Integer; N : Integer) return Integer is
    Ret : Integer := 0;
  begin
    if N /= 0 then
      Ret := A.all;
    end if;
    Ret := Ret + A.all;
    return Ret;
  end;

for which raising Storage_Error is sort of expected with -gnatp.

Reply via email to