aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/addr14.adb
blob: e92c902f038791ec915561308020718314af5928 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--  { dg-do run }

with System;

procedure Addr14 is

  type Arr is array (1 .. 4) of aliased Integer;

  A : Arr := (1, 2, 3, 4);
  I : Natural := 0;

  function Get_Address return System.Address is
  begin
    I := I + 1;
    return A(I)'Address;
  end;

  Foo : Integer with Address => Get_Address;

begin
  if Foo /= 1 then
    raise Program_Error;
  end if;
end;