From: Eric Botcazou Date: Mon, 14 Apr 2008 11:34:05 +0000 (+0000) Subject: loop_address2.adb: New test. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e965b4534fb33510b35640bcc36873d398817374;p=gcc.git loop_address2.adb: New test. * gnat.dg/loop_address2.adb: New test. From-SVN: r134258 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3229eb0ad82..23a6dd3c0a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-04-14 Eric Botcazou + + * gnat.dg/loop_address2.adb: New test. + 2008-04-13 Jerry DeLisle 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 00000000000..aa955d771b2 --- /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 ;