summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-07 13:44:58 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-07 13:44:58 +0000
commit634cb0c6a0f7a382d61aabb00d338e29ad2e4636 (patch)
treee30a6c2ac9168d789debec16cca6c032819fd784 /gcc
parentfafde4a3244171bbc646582565e8cf8235a8c807 (diff)
downloadgcc-634cb0c6a0f7a382d61aabb00d338e29ad2e4636.tar.gz
Add new tests
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125529 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gnat.dg/aliased_prefix_accessibility.adb68
-rw-r--r--gcc/testsuite/gnat.dg/asynch.adb24
-rw-r--r--gcc/testsuite/gnat.dg/asynch.ads8
-rw-r--r--gcc/testsuite/gnat.dg/bip_prim_func.adb14
-rw-r--r--gcc/testsuite/gnat.dg/bip_prim_func.ads11
-rw-r--r--gcc/testsuite/gnat.dg/fixedpnt.adb10
-rw-r--r--gcc/testsuite/gnat.dg/interface3.adb31
-rw-r--r--gcc/testsuite/gnat.dg/specs/access3.ads25
-rw-r--r--gcc/testsuite/gnat.dg/tagged_type_pkg.adb18
-rw-r--r--gcc/testsuite/gnat.dg/tagged_type_pkg.ads9
-rw-r--r--gcc/testsuite/gnat.dg/valid1.adb24
11 files changed, 242 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/aliased_prefix_accessibility.adb b/gcc/testsuite/gnat.dg/aliased_prefix_accessibility.adb
new file mode 100644
index 00000000000..c41a4bcf3a9
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/aliased_prefix_accessibility.adb
@@ -0,0 +1,68 @@
+-- { dg-do run }
+
+with Tagged_Type_Pkg; use Tagged_Type_Pkg;
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure Aliased_Prefix_Accessibility is
+
+ T_Obj : aliased TT;
+
+ T_Obj_Acc : access TT'Class := T_Obj'Access;
+
+ type Nested_TT is limited record
+ TT_Comp : aliased TT;
+ end record;
+
+ NTT_Obj : Nested_TT;
+
+ ATT_Obj : array (1 .. 2) of aliased TT;
+
+begin
+ begin
+ T_Obj_Acc := Pass_TT_Access (T_Obj'Access);
+ Put_Line ("FAILED (1): call should have raised an exception");
+ exception
+ when others =>
+ null;
+ end;
+
+ begin
+ T_Obj_Acc := T_Obj.Pass_TT_Access;
+ Put_Line ("FAILED (2): call should have raised an exception");
+ exception
+ when others =>
+ null;
+ end;
+
+ begin
+ T_Obj_Acc := Pass_TT_Access (NTT_Obj.TT_Comp'Access);
+ Put_Line ("FAILED (3): call should have raised an exception");
+ exception
+ when others =>
+ null;
+ end;
+
+ begin
+ T_Obj_Acc := NTT_Obj.TT_Comp.Pass_TT_Access;
+ Put_Line ("FAILED (4): call should have raised an exception");
+ exception
+ when others =>
+ null;
+ end;
+
+ begin
+ T_Obj_Acc := Pass_TT_Access (ATT_Obj (1)'Access);
+ Put_Line ("FAILED (5): call should have raised an exception");
+ exception
+ when others =>
+ null;
+ end;
+
+ begin
+ T_Obj_Acc := ATT_Obj (2).Pass_TT_Access;
+ Put_Line ("FAILED (6): call should have raised an exception");
+ exception
+ when others =>
+ null;
+ end;
+end Aliased_Prefix_Accessibility;
diff --git a/gcc/testsuite/gnat.dg/asynch.adb b/gcc/testsuite/gnat.dg/asynch.adb
new file mode 100644
index 00000000000..024af725cd1
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/asynch.adb
@@ -0,0 +1,24 @@
+-- { dg-do compile }
+
+package body asynch is
+ function null_ctrl return t_ctrl is
+ begin
+ return (Ada.Finalization.Controlled with stuff => 0);
+ end null_ctrl;
+
+ procedure Proc (msg : String; c : t_ctrl := null_ctrl) is
+ begin
+ null;
+ end Proc;
+
+ task type tsk;
+ task body tsk is
+ begin
+ select
+ delay 10.0;
+ Proc ("A message.");
+ then abort
+ null;
+ end select;
+ end tsk;
+end asynch;
diff --git a/gcc/testsuite/gnat.dg/asynch.ads b/gcc/testsuite/gnat.dg/asynch.ads
new file mode 100644
index 00000000000..c9b70aaf00e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/asynch.ads
@@ -0,0 +1,8 @@
+with Ada.Finalization;
+package asynch is
+ type t_ctrl is new Ada.Finalization.Controlled with record
+ stuff : Natural := 0;
+ end record;
+
+ function null_ctrl return t_ctrl;
+end asynch;
diff --git a/gcc/testsuite/gnat.dg/bip_prim_func.adb b/gcc/testsuite/gnat.dg/bip_prim_func.adb
new file mode 100644
index 00000000000..6529fe50a5a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/bip_prim_func.adb
@@ -0,0 +1,14 @@
+-- { dg-do compile }
+
+package body BIP_Prim_Func is
+
+ type NTT is new TT with record
+ J : Integer;
+ end record;
+
+ function Prim_Func return NTT is
+ begin
+ return Result : NTT := (I => 1, J => 2);
+ end Prim_Func;
+
+end BIP_Prim_Func;
diff --git a/gcc/testsuite/gnat.dg/bip_prim_func.ads b/gcc/testsuite/gnat.dg/bip_prim_func.ads
new file mode 100644
index 00000000000..37f7ac0fd30
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/bip_prim_func.ads
@@ -0,0 +1,11 @@
+
+package BIP_Prim_Func is
+ pragma Elaborate_Body;
+
+ type TT is abstract tagged limited record
+ I : Integer;
+ end record;
+
+ function Prim_Func return TT is abstract;
+
+end BIP_Prim_Func;
diff --git a/gcc/testsuite/gnat.dg/fixedpnt.adb b/gcc/testsuite/gnat.dg/fixedpnt.adb
new file mode 100644
index 00000000000..2e9988c33bb
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/fixedpnt.adb
@@ -0,0 +1,10 @@
+-- { dg-do run }
+
+procedure Fixedpnt is
+ A : Duration := 1.0;
+ B : Duration := Duration ((-1.0) * A);
+begin
+ if B > 0.0 then
+ raise Constraint_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/interface3.adb b/gcc/testsuite/gnat.dg/interface3.adb
new file mode 100644
index 00000000000..da38a1fb798
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/interface3.adb
@@ -0,0 +1,31 @@
+-- { dg-do run }
+
+procedure interface3 is
+--
+ package Pkg is
+ type Foo is interface;
+ subtype Element_Type is Foo'Class;
+--
+ type Element_Access is access Element_Type;
+ type Elements_Type is array (1 .. 1) of Element_Access;
+ type Elements_Access is access Elements_Type;
+--
+ type Vector is tagged record
+ Elements : Elements_Access;
+ end record;
+--
+ procedure Test (Obj : Vector);
+ end;
+--
+ package body Pkg is
+ procedure Test (Obj : Vector) is
+ Elements : Elements_Access := new Elements_Type;
+--
+ begin
+ Elements (1) := new Element_Type'(Obj.Elements (1).all);
+ end;
+ end;
+--
+begin
+ null;
+end;
diff --git a/gcc/testsuite/gnat.dg/specs/access3.ads b/gcc/testsuite/gnat.dg/specs/access3.ads
new file mode 100644
index 00000000000..f7fbf7e1e74
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/access3.ads
@@ -0,0 +1,25 @@
+-- { dg-do compile }
+
+package access3 is
+ type TF is access function return access procedure (P1 : Integer);
+
+ type TAF is access protected function return access procedure (P1 : Integer);
+
+ type TAF2 is access
+ function return access protected procedure (P1 : Integer);
+
+ type TAF3 is access
+ protected function return access protected procedure (P1 : Integer);
+
+ type TAF_Inf is
+ access protected function return
+ access function return
+ access function return
+ access function return
+ access function return
+ access function return
+ access function return
+ access function return
+ access function return
+ Integer;
+end access3;
diff --git a/gcc/testsuite/gnat.dg/tagged_type_pkg.adb b/gcc/testsuite/gnat.dg/tagged_type_pkg.adb
new file mode 100644
index 00000000000..dea1b54617d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/tagged_type_pkg.adb
@@ -0,0 +1,18 @@
+package body Tagged_Type_Pkg is
+
+ function Pass_TT_Access (Obj : access TT'Class) return access TT'Class is
+ begin
+ if Obj = null then
+ return null;
+
+ else
+ -- The implicit conversion in the assignment to the return object
+ -- must fail if Obj's actual is not a library-level object.
+
+ return TT_Acc : access TT'Class := Obj do
+ TT_Acc := TT_Acc.Self;
+ end return;
+ end if;
+ end Pass_TT_Access;
+
+end Tagged_Type_Pkg;
diff --git a/gcc/testsuite/gnat.dg/tagged_type_pkg.ads b/gcc/testsuite/gnat.dg/tagged_type_pkg.ads
new file mode 100644
index 00000000000..80926103214
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/tagged_type_pkg.ads
@@ -0,0 +1,9 @@
+package Tagged_Type_Pkg is
+
+ type TT is tagged limited record
+ Self : access TT'Class := TT'Unchecked_Access;
+ end record;
+
+ function Pass_TT_Access (Obj : access TT'Class) return access TT'Class;
+
+end Tagged_Type_Pkg;
diff --git a/gcc/testsuite/gnat.dg/valid1.adb b/gcc/testsuite/gnat.dg/valid1.adb
new file mode 100644
index 00000000000..a24376733b1
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/valid1.adb
@@ -0,0 +1,24 @@
+-- { dg-do run }
+-- { dg-options "-gnatVi" }
+
+procedure valid1 is
+ type m is range 0 .. 10;
+ for m'size use 8;
+
+ type r is record
+ a, b : m;
+ c, d, e, f : boolean;
+ end record;
+ pragma Pack (r);
+ for R'size use 20;
+
+ type G is array (1 .. 3, 1 .. 3) of R;
+ pragma Pack (G);
+
+ procedure h (c : m) is begin null; end;
+
+ GG : G := (others => (others => (2, 3, true, true, true, true)));
+
+begin
+ h (GG (3, 2).a);
+end;