2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gnat.dg / trampoline2.adb
blob26b42722ac7fa36b262784a3825fcdfd533c73c4
1 -- { dg-do run }
2 -- { dg-options "-gnatws" }
4 with System; use System;
6 procedure Trampoline2 is
8 A : Integer;
10 type FuncPtr is access function (I : Integer) return Integer;
12 function F (I : Integer) return Integer is
13 begin
14 return A + I;
15 end F;
17 P : FuncPtr := F'Access;
18 CA : System.Address := F'Code_Address;
19 I : Integer;
21 begin
22 if CA = System.Null_Address then
23 raise Program_Error;
24 end if;
26 I := P(0);
27 end;