From f0092c54c8dbbaeb8b34c99591b39415ad7e1442 Mon Sep 17 00:00:00 2001
From: Arnaud Charlet <charlet@gcc.gnu.org>
Date: Thu, 16 Aug 2007 10:18:31 +0200
Subject: [PATCH] Add test cases

From-SVN: r127534
---
 gcc/testsuite/gnat.dg/controlled2.adb       | 10 ++++++++++
 gcc/testsuite/gnat.dg/itypes.adb            | 22 +++++++++++++++++++++
 gcc/testsuite/gnat.dg/itypes.ads            |  4 ++++
 gcc/testsuite/gnat.dg/modify_a_constant.adb | 19 ++++++++++++++++++
 gcc/testsuite/gnat.dg/warn2.adb             | 14 +++++++++++++
 5 files changed, 69 insertions(+)
 create mode 100644 gcc/testsuite/gnat.dg/controlled2.adb
 create mode 100644 gcc/testsuite/gnat.dg/itypes.adb
 create mode 100644 gcc/testsuite/gnat.dg/itypes.ads
 create mode 100644 gcc/testsuite/gnat.dg/modify_a_constant.adb
 create mode 100644 gcc/testsuite/gnat.dg/warn2.adb

diff --git a/gcc/testsuite/gnat.dg/controlled2.adb b/gcc/testsuite/gnat.dg/controlled2.adb
new file mode 100644
index 00000000000..4fa61aff805
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/controlled2.adb
@@ -0,0 +1,10 @@
+--  { dg-do compile }
+
+with controlled1; use controlled1;
+package body controlled2 is
+   procedure Test_Suite is
+   begin
+      Add_Test
+        (new Test_Case'(Test_Case1 with Link_Under_Test => 300));
+   end Test_Suite;
+end controlled2;
diff --git a/gcc/testsuite/gnat.dg/itypes.adb b/gcc/testsuite/gnat.dg/itypes.adb
new file mode 100644
index 00000000000..fc9f10dcb74
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/itypes.adb
@@ -0,0 +1,22 @@
+--  { dg-do compile }
+
+package body itypes is
+   Size : constant := 10;
+   type Arr is array (1 .. size) of Integer;
+   
+   type Rec is record
+      Field1 : Arr := (others => 0);
+      Field2 : Arr := (others => 0);
+      Field3 : Arr := (others => 0);
+      Field4 : Arr := (others => 0);
+      Field5 : Arr := (others => 0);
+      Field6 : Arr := (others => 0);
+      Field7 : Arr := (others => 0);
+   end record;
+   
+   procedure Proc is
+      Temp1 : Rec;
+   begin   
+      null;
+   end;    
+end;                 
diff --git a/gcc/testsuite/gnat.dg/itypes.ads b/gcc/testsuite/gnat.dg/itypes.ads
new file mode 100644
index 00000000000..f6137e26ebd
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/itypes.ads
@@ -0,0 +1,4 @@
+
+package itypes is
+   procedure Proc;
+end;  
diff --git a/gcc/testsuite/gnat.dg/modify_a_constant.adb b/gcc/testsuite/gnat.dg/modify_a_constant.adb
new file mode 100644
index 00000000000..576378b0bd2
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/modify_a_constant.adb
@@ -0,0 +1,19 @@
+--  { dg-do compile }
+
+with text_io; use text_io;
+procedure modify_a_constant is
+    type Outer;
+    type Inner (Outer_Ref : access Outer) is limited null record;
+        
+    type Outer is limited record
+        Inner_Field   : Inner (Outer_Ref => Outer'Access);
+        Integer_Field : Integer;
+      end record;
+     
+    X : constant Outer := (Inner_Field => <>, Integer_Field => 123);
+     
+begin
+   Put_Line (Integer'image (X.Integer_Field));
+   X.Inner_Field.Outer_Ref.Integer_Field := 0;
+   Put_Line (Integer'image (X.Integer_Field));
+end Modify_A_Constant;
diff --git a/gcc/testsuite/gnat.dg/warn2.adb b/gcc/testsuite/gnat.dg/warn2.adb
new file mode 100644
index 00000000000..8675a524f29
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/warn2.adb
@@ -0,0 +1,14 @@
+--  { dg-do compile }
+
+with Unchecked_Conversion;
+procedure warn2 is
+   type R1 is record X : Integer; end record;
+   type R2 is record X, Y : Integer; end record;
+   pragma Warnings
+     (Off, "types for unchecked conversion have different sizes");
+   function F is new Unchecked_Conversion (R1, R2);
+   pragma Warnings
+     (On, "types for unchecked conversion have different sizes");
+begin
+   null;
+end warn2;