Commit a03cc04a by Arnaud Charlet

New tests

From-SVN: r133593
parent 0afae63b
-- { dg-do compile }
package body Forward_Anon is
function Get_Current return access Object is
begin
return Current_Object;
end;
end;
package Forward_Anon is
type Object is null record;
function Get_Current return access Object;
Current_Object : constant access Object;
private
One_Object : aliased Object;
Current_Object : constant access Object := One_Object'Access;
end;
generic
type Data is private;
package Iface1 is
type Future is synchronized interface;
type Any_Future is access all Future;
procedure Get (This : in out Future; P : out Data) is abstract;
procedure Set (This : in out Future; P : in Data) is abstract;
type Reusable_Future is synchronized interface and Future;
type Any_Reusable_Future is access all Reusable_Future'Class;
end Iface1;
-- { dg-do compile }
package body Iface2 is
procedure change (This, That : Prot.Any_Future) is
begin
null;
end;
end Iface2;
with Iface1;
generic
with package Prot is new Iface1 (<>);
package Iface2 is
procedure change (This, That : Prot.Any_Future);
end Iface2;
-- { dg-do run }
-- { dg-options "-gnatws -gnatVa" }
pragma Initialize_Scalars;
procedure init_scalar1 is
type Fixed_3T is delta 2.0 ** (- 4)
range - 2.0 ** 19 .. (2.0 ** 19 - 2.0 ** (- 4));
for Fixed_3T'Size use 3*8;
Write_Value : constant Fixed_3T := Fixed_3T(524287.875);
type singleton is array (1 .. 1) of Fixed_3T;
pragma Pack (singleton);
it : Singleton;
begin
null;
end;
-- { dg-do compile }
procedure Self1 is
type Event;
type Link (E : access Event) is limited record
Val : Integer;
end record;
type Ptr is access all Event;
type Event is tagged limited record
Inner : Link (Event'access);
Size : Integer;
end record;
Obj2 : Ptr := new Event'(Inner => (Event'access, 15),
Size => Link'size);
begin
null;
end;
-- { dg-do compile }
-- { dg-options "-gnatc" }
pragma Restrictions (No_Entry_Queue);
package Restricted_Pkg is
type Iface is limited interface;
protected type PO is new Iface with
procedure Dummy;
end;
end;
-- { dg-do compile }
pragma Restrictions (No_Allocators);
procedure Test_BIP_No_Alloc is
type LR (B : Boolean) is limited record
X : Integer;
end record;
function FLR return LR is
begin
-- A return statement in a function with a limited and unconstrained
-- result subtype can result in expansion of an allocator for the
-- secondary stack, but that should not result in a violation of the
-- restriction No_Allocators.
return (B => False, X => 123);
end FLR;
Obj : LR := FLR;
begin
null;
end Test_BIP_No_Alloc;
-- { dg-do run }
procedure too_many_tasks is
Global : Natural := 0;
function Output return Integer is
begin
Global := Global + 1;
return Global;
end Output;
task type A;
task type B;
task body A is
I : Integer := Output;
T : B;
begin null; end A;
task body B is
I : Integer := Output;
T : A;
begin null; end B;
T : A;
begin null; end;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment