https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101373
--- Comment #14 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > function Bar (A : access Integer; N : Integer) return Integer is > Ret : Integer := 0; > Ret2 : Integer := 0; > begin > if N /= 0 then > Ret2 := Foo (N); > Ret := A.all; > end if; > Ret := Ret + A.all; > return Ret + Ret2; > end; > > seems to work as in, FAIL without the patch and PASS with it. OK, I can reproduce it. Please use the Pure_Function version for gnat.dg: function Foo (J : Integer) return Integer; pragma Pure_Function (Foo); pragma Machine_Attribute (Foo, "noipa");