aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/loop_address2.adb26
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3229eb0..23a6dd3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-04-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/loop_address2.adb: New test.
+
2008-04-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/35882
diff --git a/gcc/testsuite/gnat.dg/loop_address2.adb b/gcc/testsuite/gnat.dg/loop_address2.adb
new file mode 100644
index 0000000..aa955d7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_address2.adb
@@ -0,0 +1,26 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+with System, Ada.Unchecked_Conversion;
+with System.Storage_Elements; use System.Storage_Elements;
+
+procedure Loop_Address2 is
+
+ type Ptr is access all Integer;
+
+ function To_Ptr is new Ada.Unchecked_Conversion (System.Address, Ptr);
+
+ function F (BM : System.Address; I : Integer) return System.Address is
+ begin
+ return BM + Storage_Offset (4*I);
+ end;
+
+ B : Integer;
+ P : Ptr;
+
+begin
+ for I in 0 .. 2 loop
+ P := To_Ptr (F (B'Address, I));
+ P.all := 0;
+ end loop;
+end ;