2016-11-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
[official-gcc.git] / gcc / testsuite / gnat.dg / pointer_conversion.adb
blob8ed2e0d54891cdf245a1cc4ed16b4bd4f2ee007b
1 -- { dg-do run }
2 -- { dg-options "-O2" }
4 with Unchecked_Conversion;
6 procedure pointer_conversion is
8 type int1 is new integer;
9 type int2 is new integer;
10 type a1 is access int1;
11 type a2 is access int2;
13 function to_a2 is new Unchecked_Conversion (a1, a2);
15 v1 : a1 := new int1;
16 v2 : a2 := to_a2 (v1);
18 begin
19 v1.all := 1;
20 v2.all := 0;
22 if v1.all /= 0 then
23 raise Program_Error;
24 end if;
25 end;