blob: 9f1be3c5902a0544ccfdf22feb4e48660e91e17a (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
-- { dg-do run }
procedure alignment2 is
pragma COMPONENT_ALIGNMENT(STORAGE_UNIT);
MAX_LIST_SIZE : constant INTEGER := 128*16;
LEVEL2_SIZE : constant INTEGER := 128;
LEVEL1_SIZE : constant INTEGER
:= (MAX_LIST_SIZE - 1) / LEVEL2_SIZE + 1;
type LEVEL2_ARRAY_TYPE is
array (1..LEVEL2_SIZE) of Integer;
type LEVEL2_TYPE is
record
NUM : INTEGER := 0;
DATA : LEVEL2_ARRAY_TYPE := ( others => 0 );
end record;
type LEVEL2_PTR_TYPE is access all LEVEL2_TYPE;
type LEVEL1_ARRAY_TYPE is
array( 1..LEVEL1_SIZE ) of LEVEL2_PTR_TYPE;
type LEVEL1_TYPE is
record
LAST_LINE : INTEGER := 0;
LEVEL2_PTR : LEVEL1_ARRAY_TYPE;
end record;
L1 : LEVEL1_TYPE;
L2 : aliased LEVEL2_TYPE;
procedure q (LA : in out LEVEL1_ARRAY_TYPE) is
begin
LA (1) := L2'Access;
end;
begin
q (L1.LEVEL2_PTR);
if L1.LEVEL2_PTR (1) /= L2'Access then
raise Program_Error;
end if;
end;
|