| 1 |
with System, System.Storage_Elements; |
| 2 |
use System.Storage_Elements; |
| 3 |
|
| 4 |
package body Allocator_Maxalign2 is |
| 5 |
|
| 6 |
Max_Align : constant Storage_Offset := Standard'Maximum_Alignment; |
| 7 |
|
| 8 |
procedure Validate is |
| 9 |
use type System.Address; |
| 10 |
begin |
| 11 |
if Addr mod Max_Align /= 0 then |
| 12 |
raise Program_Error; |
| 13 |
end if; |
| 14 |
end; |
| 15 |
|
| 16 |
procedure Check is |
| 17 |
I : Integer; |
| 18 |
B : Block; |
| 19 |
type Block_Access is access all Block; |
| 20 |
A : Block_Access; |
| 21 |
begin |
| 22 |
Addr := I'Address; |
| 23 |
Addr := B'Address; |
| 24 |
Validate; |
| 25 |
for I in 1 .. 50 loop |
| 26 |
A := new Block; |
| 27 |
Addr := A.all'Address; |
| 28 |
Validate; |
| 29 |
end loop; |
| 30 |
|
| 31 |
end; |
| 32 |
|
| 33 |
end; |