1-- { dg-do run }
2-- { dg-options "-O2" }
3
4with Unchecked_Conversion;
5
6procedure pointer_conversion is
7
8   type int1 is new integer;
9   type int2 is new integer;
10   type a1 is access int1;
11   type a2 is access int2;
12
13   function to_a2 is new Unchecked_Conversion (a1, a2);
14
15   v1 : a1 := new int1;
16   v2 : a2 := to_a2 (v1);
17
18begin
19   v1.all := 1;
20   v2.all := 0;
21
22   if v1.all /= 0 then
23      raise Program_Error;
24   end if;
25end;
26