Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gnat.dg / alignment2.adb
blob9f1be3c5902a0544ccfdf22feb4e48660e91e17a
1 -- { dg-do run }
3 procedure alignment2 is
5 pragma COMPONENT_ALIGNMENT(STORAGE_UNIT);
7 MAX_LIST_SIZE : constant INTEGER := 128*16;
9 LEVEL2_SIZE : constant INTEGER := 128;
11 LEVEL1_SIZE : constant INTEGER
12 := (MAX_LIST_SIZE - 1) / LEVEL2_SIZE + 1;
14 type LEVEL2_ARRAY_TYPE is
15 array (1..LEVEL2_SIZE) of Integer;
17 type LEVEL2_TYPE is
18 record
19 NUM : INTEGER := 0;
20 DATA : LEVEL2_ARRAY_TYPE := ( others => 0 );
21 end record;
23 type LEVEL2_PTR_TYPE is access all LEVEL2_TYPE;
25 type LEVEL1_ARRAY_TYPE is
26 array( 1..LEVEL1_SIZE ) of LEVEL2_PTR_TYPE;
28 type LEVEL1_TYPE is
29 record
30 LAST_LINE : INTEGER := 0;
31 LEVEL2_PTR : LEVEL1_ARRAY_TYPE;
32 end record;
34 L1 : LEVEL1_TYPE;
35 L2 : aliased LEVEL2_TYPE;
37 procedure q (LA : in out LEVEL1_ARRAY_TYPE) is
38 begin
39 LA (1) := L2'Access;
40 end;
42 begin
43 q (L1.LEVEL2_PTR);
44 if L1.LEVEL2_PTR (1) /= L2'Access then
45 raise Program_Error;
46 end if;
47 end;