Hi,
the varying case currently falls through to the 1/true case.
Tested on x86_64-suse-linux, OK for mainline, 13 and 12 branches?
2023-09-25 Eric Botcazou <ebotca...@adacore.com>
* gimple-range-gori.cc (gori_compute::logical_combine): Add missing
return statement in the varying case.
2023-09-25 Eric Botcazou <ebotca...@adacore.com>
* gnat.dg/opt102.adb:New test.
* gnat.dg/opt102_pkg.adb, gnat.dg/opt102_pkg.ads: New helper.
--
Eric Botcazou
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 51fb542a19c..2694e551d73 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -876,6 +876,7 @@ gori_compute::logical_combine (vrange &r, enum tree_code code,
r.dump (dump_file);
fputc ('\n', dump_file);
}
+ return res;
}
switch (code)
package body Opt102_Pkg is
function Get (E : Enum; F, M : access Integer) return Integer is
begin
case E is
when One => return 0;
when Two => return F.all;
when Three => return M.all;
end case;
end;
end Opt102_Pkg;
-- { dg-do run }
-- { dg-options "-O2 -gnata" }
with Opt102_Pkg; use Opt102_Pkg;
procedure Opt102 is
I, F : aliased Integer;
begin
I := Get (Two, F'Access, null);
end;
package Opt102_Pkg is
type Enum is (One, Two, Three);
function Get (E : Enum; F, M : access Integer) return Integer
with Pre => (E = One) = (F = null and M = null) and
(E = Two) = (F /= null) and
(E = Three) = (M /= null);
end Opt102_Pkg;