gcc/cp
[official-gcc.git] / gcc / testsuite / gnat.dg / gnat_malloc.adb
blob7e8d6140b19538cfc0b6a267ef712e898b651cd0
1 -- { dg-do run }
2 -- { dg-options "-O2" }
4 with Unchecked_Conversion;
6 procedure gnat_malloc 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;