aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r--gcc/testsuite/gnat.dg/opt105.adb30
-rw-r--r--gcc/testsuite/gnat.dg/opt105_pkg.adb6
-rw-r--r--gcc/testsuite/gnat.dg/opt105_pkg.ads11
3 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/opt105.adb b/gcc/testsuite/gnat.dg/opt105.adb
new file mode 100644
index 0000000..eb2c197
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt105.adb
@@ -0,0 +1,30 @@
+-- { dg-do run }
+-- { dg-options "-O" }
+
+with Opt105_Pkg; use Opt105_Pkg;
+
+procedure Opt105 is
+
+ Val : constant Enum :=
+ (if Enabled then (if Disabled then Two else One) else Three);
+
+begin
+ if Cond1 then
+ return;
+ end if;
+
+ if Cond2 then
+ return;
+ end if;
+
+ case Val is
+ when One =>
+ raise Program_Error;
+
+ when Two =>
+ raise Constraint_Error;
+
+ when Three =>
+ null;
+ end case;
+end;
diff --git a/gcc/testsuite/gnat.dg/opt105_pkg.adb b/gcc/testsuite/gnat.dg/opt105_pkg.adb
new file mode 100644
index 0000000..e00de94
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt105_pkg.adb
@@ -0,0 +1,6 @@
+package body Opt105_Pkg is
+
+ function Cond1 return Boolean is (False);
+ function Cond2 return Boolean is (False);
+
+end Opt105_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt105_pkg.ads b/gcc/testsuite/gnat.dg/opt105_pkg.ads
new file mode 100644
index 0000000..2b373b7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt105_pkg.ads
@@ -0,0 +1,11 @@
+package Opt105_Pkg is
+
+ type Enum is (One, Two, Three);
+
+ Enabled : Boolean := False;
+ Disabled : Boolean := False;
+
+ function Cond1 return Boolean;
+ function Cond2 return Boolean;
+
+end Opt105_Pkg;