-- { dg-do run }
|
-- { dg-do run }
|
|
|
procedure alignment2 is
|
procedure alignment2 is
|
|
|
pragma COMPONENT_ALIGNMENT(STORAGE_UNIT);
|
pragma COMPONENT_ALIGNMENT(STORAGE_UNIT);
|
|
|
MAX_LIST_SIZE : constant INTEGER := 128*16;
|
MAX_LIST_SIZE : constant INTEGER := 128*16;
|
|
|
LEVEL2_SIZE : constant INTEGER := 128;
|
LEVEL2_SIZE : constant INTEGER := 128;
|
|
|
LEVEL1_SIZE : constant INTEGER
|
LEVEL1_SIZE : constant INTEGER
|
:= (MAX_LIST_SIZE - 1) / LEVEL2_SIZE + 1;
|
:= (MAX_LIST_SIZE - 1) / LEVEL2_SIZE + 1;
|
|
|
type LEVEL2_ARRAY_TYPE is
|
type LEVEL2_ARRAY_TYPE is
|
array (1..LEVEL2_SIZE) of Integer;
|
array (1..LEVEL2_SIZE) of Integer;
|
|
|
type LEVEL2_TYPE is
|
type LEVEL2_TYPE is
|
record
|
record
|
NUM : INTEGER := 0;
|
NUM : INTEGER := 0;
|
DATA : LEVEL2_ARRAY_TYPE := ( others => 0 );
|
DATA : LEVEL2_ARRAY_TYPE := ( others => 0 );
|
end record;
|
end record;
|
|
|
type LEVEL2_PTR_TYPE is access all LEVEL2_TYPE;
|
type LEVEL2_PTR_TYPE is access all LEVEL2_TYPE;
|
|
|
type LEVEL1_ARRAY_TYPE is
|
type LEVEL1_ARRAY_TYPE is
|
array( 1..LEVEL1_SIZE ) of LEVEL2_PTR_TYPE;
|
array( 1..LEVEL1_SIZE ) of LEVEL2_PTR_TYPE;
|
|
|
type LEVEL1_TYPE is
|
type LEVEL1_TYPE is
|
record
|
record
|
LAST_LINE : INTEGER := 0;
|
LAST_LINE : INTEGER := 0;
|
LEVEL2_PTR : LEVEL1_ARRAY_TYPE;
|
LEVEL2_PTR : LEVEL1_ARRAY_TYPE;
|
end record;
|
end record;
|
|
|
L1 : LEVEL1_TYPE;
|
L1 : LEVEL1_TYPE;
|
L2 : aliased LEVEL2_TYPE;
|
L2 : aliased LEVEL2_TYPE;
|
|
|
procedure q (LA : in out LEVEL1_ARRAY_TYPE) is
|
procedure q (LA : in out LEVEL1_ARRAY_TYPE) is
|
begin
|
begin
|
LA (1) := L2'Access;
|
LA (1) := L2'Access;
|
end;
|
end;
|
|
|
begin
|
begin
|
q (L1.LEVEL2_PTR);
|
q (L1.LEVEL2_PTR);
|
if L1.LEVEL2_PTR (1) /= L2'Access then
|
if L1.LEVEL2_PTR (1) /= L2'Access then
|
raise Program_Error;
|
raise Program_Error;
|
end if;
|
end if;
|
end;
|
end;
|
|
|