| 1 |
-- { dg-do compile } |
| 2 |
-- { dg-options "-O" } |
| 3 |
|
| 4 |
with System, Ada.Unchecked_Conversion; |
| 5 |
with System.Storage_Elements; use System.Storage_Elements; |
| 6 |
|
| 7 |
procedure Loop_Address2 is |
| 8 |
|
| 9 |
type Ptr is access all Integer; |
| 10 |
|
| 11 |
function To_Ptr is new Ada.Unchecked_Conversion (System.Address, Ptr); |
| 12 |
|
| 13 |
function F (BM : System.Address; I : Integer) return System.Address is |
| 14 |
begin |
| 15 |
return BM + Storage_Offset (4*I); |
| 16 |
end; |
| 17 |
|
| 18 |
B : Integer; |
| 19 |
P : Ptr; |
| 20 |
|
| 21 |
begin |
| 22 |
for I in 0 .. 2 loop |
| 23 |
P := To_Ptr (F (B'Address, I)); |
| 24 |
P.all := 0; |
| 25 |
end loop; |
| 26 |
end ; |