public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4255] Add missing return in gori_compute::logical_combine
@ 2023-09-25 18:51 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-09-25 18:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:19df06f67c982b4e5427c4a056319d6a51c03481
commit r14-4255-g19df06f67c982b4e5427c4a056319d6a51c03481
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Mon Sep 25 20:48:53 2023 +0200
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.
Diff:
---
gcc/gimple-range-gori.cc | 1 +
gcc/testsuite/gnat.dg/opt102.adb | 10 ++++++++++
gcc/testsuite/gnat.dg/opt102_pkg.adb | 12 ++++++++++++
gcc/testsuite/gnat.dg/opt102_pkg.ads | 10 ++++++++++
4 files changed, 33 insertions(+)
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)
diff --git a/gcc/testsuite/gnat.dg/opt102.adb b/gcc/testsuite/gnat.dg/opt102.adb
new file mode 100644
index 00000000000..2b5bec54c3d
--- /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 00000000000..09c338d0517
--- /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 00000000000..7afc3fe6ac7
--- /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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-25 18:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25 18:51 [gcc r14-4255] Add missing return in gori_compute::logical_combine Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).