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/opt58.adb19
-rw-r--r--gcc/testsuite/gnat.dg/opt58_pkg.ads19
2 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/opt58.adb b/gcc/testsuite/gnat.dg/opt58.adb
new file mode 100644
index 00000000000..ac39cc06056
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt58.adb
@@ -0,0 +1,19 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+with Unchecked_Conversion;
+with System; use System;
+with Opt58_Pkg; use Opt58_Pkg;
+
+procedure Opt58 is
+
+ function Convert is new Unchecked_Conversion (Integer, Rec);
+
+ Dword : Integer := 0;
+ I : Small_Int := F1 (Convert (Dword));
+
+begin
+ if F2 (Null_Address, I = 0) then
+ null;
+ end if;
+end Opt58;
diff --git a/gcc/testsuite/gnat.dg/opt58_pkg.ads b/gcc/testsuite/gnat.dg/opt58_pkg.ads
new file mode 100644
index 00000000000..9cb7f3a2540
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt58_pkg.ads
@@ -0,0 +1,19 @@
+with System; use System;
+
+package Opt58_Pkg is
+
+ pragma Pure (Opt58_Pkg);
+
+ type Small_Int is range 0 .. 255;
+
+ type Rec is record
+ D1, D2, D3, D4 : Small_Int;
+ end record;
+ pragma Pack (Rec);
+ for Rec'Size use 32;
+
+ function F1 (R : Rec) return Small_Int;
+
+ function F2 (A : Address; B : Boolean) return Boolean;
+
+end Opt58_Pkg;