[Bug tree-optimization/101373] PRE hoists trapping instructions over possibly throwing calls
ebotcazou at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 9 09:28:36 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101373
--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Eric, is it possible to write an equivalent testcase in Ada?
procedure P is
function Foo (J : Integer) return Integer;
pragma Machine_Attribute (Foo, "const");
pragma Machine_Attribute (Foo, "noipa");
function Foo (J : Integer) return Integer is
begin
if J /= 0 then
raise Constraint_Error;
end if;
return 0;
end;
function Bar (A : access Integer; N : Integer) return Integer;
pragma Machine_Attribute (Bar, "noipa");
function Bar (A : access Integer; N : Integer) return Integer is
Ret : Integer := 0;
begin
if N /= 0 then
Ret := Foo (N);
Ret := A.all;
end if;
Ret := Ret + A.all;
return Ret;
end;
V : Integer;
pragma Volatile (V);
begin
V := Bar (null, 1);
exception
when Constraint_Error => null;
end;
compiled with -O2 -gnatp, but I cannot have the load hoisted in this case.
More information about the Gcc-bugs
mailing list