summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/address_conversion.adb
blob: 5813638c46b34c119b1dce583bbd953db4836ce0 (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 }
-- { dg-options "-O2" }

with System.Address_To_Access_Conversions;

procedure address_conversion is

   type Integer_type1 is new Integer;
   type Integer_type2 is new Integer;

   package AA is new System.Address_To_Access_Conversions (Integer_type1);

   K1 : Integer_type1;
   K2 : Integer_type2;

begin
   K1 := 1;
   K2 := 2;

   AA.To_Pointer(K2'Address).all := K1;
   if K2 /= 1 then
      raise Program_Error;
   end if;
end;