OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c3/] [c38002b.ada] - Blame information for rev 309

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C38002B.ADA
2
 
3
--                             Grant of Unlimited Rights
4
--
5
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained 
7
--     unlimited rights in the software and documentation contained herein.
8
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making 
9
--     this public release, the Government intends to confer upon all 
10
--     recipients unlimited rights  equal to those held by the Government.  
11
--     These rights include rights to use, duplicate, release or disclose the 
12
--     released technical data and computer software in whole or in part, in 
13
--     any manner and for any purpose whatsoever, and to have or permit others 
14
--     to do so.
15
--
16
--                                    DISCLAIMER
17
--
18
--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19
--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED 
20
--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21
--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE 
22
--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23
--     PARTICULAR PURPOSE OF SAID MATERIAL.
24
--*
25
-- OBJECTIVE:
26
--     CHECK THAT AN UNCONSTRAINED ARRAY TYPE OR A RECORD WITHOUT
27
--     DEFAULT DISCRIMINANTS CAN BE USED IN AN ACCESS_TYPE_DEFINITION
28
--     WITHOUT AN INDEX OR DISCRIMINANT CONSTRAINT.
29
--
30
--     CHECK THAT (NON-STATIC) INDEX OR DISCRIMINANT CONSTRAINTS CAN
31
--     SUBSEQUENTLY BE IMPOSED WHEN THE TYPE IS USED IN AN OBJECT
32
--     DECLARATION, ARRAY COMPONENT DECLARATION, RECORD COMPONENT
33
--     DECLARATION, ACCESS TYPE DECLARATION, PARAMETER DECLARATION,
34
--     ALLOCATOR, DERIVED TYPE DEFINITION, PRIVATE TYPE, OR AS THE
35
--     RETURN TYPE IN A FUNCTION DECLARATION.
36
--
37
--     CHECK FOR GENERIC FORMAL ACCESS TYPES.
38
 
39
-- HISTORY:
40
--     AH  09/02/86 CREATED ORIGINAL TEST.
41
--     DHH 08/22/88 REVISED HEADER, ADDED 'PRIVATE TYPE' TO COMMENTS
42
--                  AND CORRECTED INDENTATION.
43
 
44
WITH REPORT; USE REPORT;
45
PROCEDURE C38002B IS
46
 
47
     C3 : CONSTANT INTEGER := IDENT_INT(3);
48
 
49
     TYPE UNCON_ARR IS ARRAY (INTEGER RANGE <>) OF INTEGER;
50
     TYPE REC (DISC : INTEGER) IS
51
          RECORD
52
               NULL;
53
          END RECORD;
54
 
55
     TYPE P_ARR_NAME IS ACCESS UNCON_ARR;
56
     TYPE P_REC_NAME IS ACCESS REC;
57
 
58
     GENERIC
59
          TYPE ACC_REC IS ACCESS REC;
60
          TYPE ACC_ARR IS ACCESS UNCON_ARR;
61
     PACKAGE P IS
62
          OBJ : ACC_REC(C3);
63
 
64
          TYPE ARR2 IS ARRAY (1..10) OF ACC_REC(C3);
65
 
66
          TYPE REC1 IS
67
               RECORD
68
                    COMP1 : ACC_REC(C3);
69
               END RECORD;
70
 
71
          TYPE REC2 IS
72
               RECORD
73
                    COMP2 : ACC_ARR(1..C3);
74
               END RECORD;
75
 
76
          SUBTYPE ACC_REC_3 IS ACC_REC(C3);
77
          R : ACC_REC;
78
 
79
          FUNCTION F (PARM : ACC_REC_3) RETURN ACC_REC_3;
80
 
81
          TYPE ACC1 IS PRIVATE;
82
          TYPE ACC2 IS PRIVATE;
83
          TYPE DER1 IS PRIVATE;
84
          TYPE DER2 IS PRIVATE;
85
 
86
     PRIVATE
87
 
88
          TYPE ACC1 IS ACCESS ACC_REC(C3);
89
          TYPE ACC2 IS ACCESS ACC_ARR(1..C3);
90
          TYPE DER1 IS NEW ACC_REC(C3);
91
          TYPE DER2 IS NEW ACC_ARR(1..C3);
92
     END P;
93
 
94
     PACKAGE BODY P IS
95
          FUNCTION F (PARM : ACC_REC_3) RETURN ACC_REC_3 IS
96
          BEGIN
97
               RETURN PARM;
98
          END;
99
     END P;
100
 
101
     PACKAGE NP IS NEW P (ACC_REC => P_REC_NAME, ACC_ARR => P_ARR_NAME);
102
 
103
     USE NP;
104
BEGIN
105
     TEST ("C38002B", "NON-STATIC CONSTRAINTS CAN BE IMPOSED " &
106
           "ON ACCESS TYPES ACCESSING PREVIOUSLY UNCONSTRAINED " &
107
           "ARRAY OR RECORD TYPES");
108
 
109
     R := NEW REC(DISC => 3);
110
     R := F(R);
111
     R := NEW REC(DISC => 4);
112
     R := F(R);
113
     FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE ACCEPTED " &
114
             "BY GENERIC FUNCTION");
115
     EXCEPTION
116
          WHEN CONSTRAINT_ERROR =>
117
               IF R = NULL OR ELSE R.DISC /= 4 THEN
118
                    FAILED (" ERROR IN EVALUATION/ASSIGNMENT OF " &
119
                            "GENERIC ACCESS VALUE");
120
               END IF;
121
 
122
     RESULT;
123
END C38002B;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.