diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-09-25 20:48:53 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2023-09-25 20:50:57 +0200 |
commit | 19df06f67c982b4e5427c4a056319d6a51c03481 (patch) | |
tree | 96c72414566c306ad627852b08b169fde7629d96 /gcc/testsuite/gnat.dg | |
parent | bf3c19903a801063551e43bdc2b8b7ea2f69b781 (diff) | |
download | gcc-19df06f67c982b4e5427c4a056319d6a51c03481.zip gcc-19df06f67c982b4e5427c4a056319d6a51c03481.tar.gz gcc-19df06f67c982b4e5427c4a056319d6a51c03481.tar.bz2 |
Add missing return in gori_compute::logical_combine
The varying case currently falls through to the 1/true case.
gcc/
* gimple-range-gori.cc (gori_compute::logical_combine): Add missing
return statement in the varying case.
gcc/testsuite/
* gnat.dg/opt102.adb:New test.
* gnat.dg/opt102_pkg.adb, gnat.dg/opt102_pkg.ads: New helper.
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r-- | gcc/testsuite/gnat.dg/opt102.adb | 10 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/opt102_pkg.adb | 12 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/opt102_pkg.ads | 10 |
3 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/opt102.adb b/gcc/testsuite/gnat.dg/opt102.adb new file mode 100644 index 0000000..2b5bec5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt102.adb @@ -0,0 +1,10 @@ +-- { 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; diff --git a/gcc/testsuite/gnat.dg/opt102_pkg.adb b/gcc/testsuite/gnat.dg/opt102_pkg.adb new file mode 100644 index 0000000..09c338d --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt102_pkg.adb @@ -0,0 +1,12 @@ +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; diff --git a/gcc/testsuite/gnat.dg/opt102_pkg.ads b/gcc/testsuite/gnat.dg/opt102_pkg.ads new file mode 100644 index 0000000..7afc3fe --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt102_pkg.ads @@ -0,0 +1,10 @@ +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; |