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/] [c6/] [c64103e.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C64103E.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, FOR IN-OUT PARAMETERS OF AN ACCESS TYPE,
27
--     CONSTRAINT_ERROR IS RAISED:
28
--          BEFORE A SUBPROGRAM CALL WHEN THE BOUNDS OR DISCRIMINANTS
29
--          OF THE ACTUAL DESIGNATED PARAMETER ARE DIFFERENT FROM
30
--          THOSE OF THE FORMAL DESIGNATED PARAMETER;
31
--          AFTER A SUBPROGRAM CALL WHEN THE BOUNDS OR DISCRIMINANTS
32
--          OF THE FORMAL DESIGNATED PARAMETER ARE DIFFERENT FROM
33
--          THOSE OF THE ACTUAL DESIGNATED PARAMETER.
34
 
35
-- HISTORY:
36
--     CPP  07/23/84  CREATED ORIGINAL TEST.
37
--     VCL  10/27/87  MODIFIED THIS HEADER; ADDED STATEMENTS WHICH
38
--                    REFERENCED THE ACTUAL PARAMETERS IN THE SECOND
39
--                    SUBTEST.
40
 
41
WITH REPORT;  USE REPORT;
42
PROCEDURE C64103E IS
43
BEGIN
44
     TEST ("C64103E", "FOR IN-OUT PARAMETERS OF AN ACCESS TYPE, " &
45
                      "CONSTRAINT_ERROR IS RAISED:  BEFORE A " &
46
                      "SUBPROGRAM CALL WHEN THE BOUNDS OR " &
47
                      "DISCRIMINANTS OF THE ACTUAL DESIGNATED " &
48
                      "PARAMETER ARE DIFFERENT FROM THOSE OF THE " &
49
                      "FORMAL DESIGNATED PARAMETER;  AFTER A " &
50
                      "SUBPROGRAM CALL WHEN THE BOUNDS OR " &
51
                      "DISCRIMINANTS OF THE FORMAL DESIGNATED " &
52
                      "PARAMETER ARE DIFFERENT FROM THOSE OF THE " &
53
                      "ACTUAL DESIGNATED PARAMETER");
54
 
55
 
56
     BEGIN
57
          DECLARE
58
               TYPE AST IS ACCESS STRING;
59
               SUBTYPE AST_3 IS AST(1..3);
60
               SUBTYPE AST_5 IS AST(3..5);
61
               X_3 : AST_3 := NEW STRING(1..IDENT_INT(3));
62
 
63
               PROCEDURE P1 (X : IN OUT AST_5) IS
64
               BEGIN
65
                    FAILED("EXCEPTION NOT RAISED BEFORE CALL -P1 (A)");
66
               END P1;
67
          BEGIN
68
               P1 (AST_5 (X_3));
69
          EXCEPTION
70
               WHEN CONSTRAINT_ERROR =>
71
                    NULL;
72
               WHEN OTHERS =>
73
                    FAILED ("WRONG EXCEPTION RAISED -P1 (A)");
74
          END;
75
 
76
          DECLARE
77
               TYPE ARRAY_TYPE IS ARRAY (INTEGER RANGE <>) OF BOOLEAN;
78
               TYPE A_ARRAY IS ACCESS ARRAY_TYPE;
79
               SUBTYPE A1_ARRAY IS A_ARRAY (1..IDENT_INT(3));
80
               TYPE A2_ARRAY IS NEW A_ARRAY (2..4);
81
               A0 : A1_ARRAY := NEW ARRAY_TYPE (1..3);
82
 
83
               PROCEDURE P2 (X : IN OUT A2_ARRAY) IS
84
               BEGIN
85
                    FAILED ("EXCEPTION NOT RAISED BEFORE CALL -P2 (A)");
86
               END P2;
87
          BEGIN
88
               P2 (A2_ARRAY (A0));
89
          EXCEPTION
90
               WHEN CONSTRAINT_ERROR =>
91
                    NULL;
92
               WHEN OTHERS =>
93
                    FAILED ("WRONG EXCEPTION RAISED -P2 (A)");
94
          END;
95
 
96
          DECLARE
97
               TYPE SUBINT IS RANGE 0..8;
98
               TYPE REC1 (DISC : SUBINT := 8) IS
99
                    RECORD
100
                         FIELD : SUBINT := DISC;
101
                    END RECORD;
102
               TYPE A1_REC IS ACCESS REC1;
103
               TYPE A2_REC IS NEW A1_REC(3);
104
               A0 : A1_REC := NEW REC1(4);
105
 
106
               PROCEDURE P3 (X : IN OUT A2_REC) IS
107
               BEGIN
108
                    FAILED ("EXCEPTION NOT RAISED BEFORE CALL " &
109
                            "-P3 (A)");
110
               END P3;
111
 
112
          BEGIN
113
               P3 (A2_REC (A0));
114
          EXCEPTION
115
               WHEN CONSTRAINT_ERROR =>
116
                    NULL;
117
               WHEN OTHERS =>
118
                    FAILED ("WRONG EXCEPTION RAISED -P3 (A)");
119
          END;
120
 
121
     END;
122
 
123
 
124
     BEGIN
125
          DECLARE
126
               TYPE AST IS ACCESS STRING;
127
               SUBTYPE AST_3 IS AST(IDENT_INT(1)..IDENT_INT(3));
128
               X_3 : AST_3 := NEW STRING'(1..IDENT_INT(3) => 'A');
129
               CALLED : BOOLEAN := FALSE;
130
 
131
               PROCEDURE P1 (X : IN OUT AST) IS
132
               BEGIN
133
                    CALLED := TRUE;
134
                    X := NEW STRING'(3..5 => 'C');
135
               END P1;
136
          BEGIN
137
               P1 (AST (X_3));
138
               IF X_3.ALL = STRING'(1 .. 3 => 'A') THEN
139
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P1 (B1)");
140
               ELSE
141
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P1 (B2)");
142
               END IF;
143
          EXCEPTION
144
               WHEN CONSTRAINT_ERROR =>
145
                    IF NOT CALLED THEN
146
                         FAILED ("EXCEPTION RAISED BEFORE CALL" &
147
                                 "-P1 (B)");
148
                    END IF;
149
               WHEN OTHERS =>
150
                    FAILED ("WRONG EXCEPTION RAISED -P1 (B)");
151
          END;
152
 
153
          DECLARE
154
               TYPE ARRAY_TYPE IS ARRAY (INTEGER RANGE <>) OF BOOLEAN;
155
               TYPE A_ARRAY IS ACCESS ARRAY_TYPE;
156
               SUBTYPE A1_ARRAY IS A_ARRAY (1..IDENT_INT(3));
157
               A0 : A1_ARRAY := NEW ARRAY_TYPE'(1..3 => TRUE);
158
               CALLED : BOOLEAN := FALSE;
159
 
160
               PROCEDURE P2 (X : IN OUT A_ARRAY) IS
161
               BEGIN
162
                    CALLED := TRUE;
163
                    X := NEW ARRAY_TYPE'(2..4 => FALSE);
164
               END P2;
165
          BEGIN
166
               P2 (A_ARRAY (A0));
167
               IF A0.ALL = ARRAY_TYPE'(1 .. 3 => TRUE) THEN
168
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P2 (B1)");
169
               ELSE
170
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P2 (B2)");
171
               END IF;
172
          EXCEPTION
173
               WHEN CONSTRAINT_ERROR =>
174
                    IF NOT CALLED THEN
175
                         FAILED ("EXCEPTION RAISED BEFORE CALL" &
176
                                 "-P1 (B)");
177
                    END IF;
178
               WHEN OTHERS =>
179
                    FAILED ("WRONG EXCEPTION RAISED -P2 (B)");
180
          END;
181
 
182
          DECLARE
183
               TYPE SUBINT IS RANGE 0..8;
184
               TYPE REC1 (DISC : SUBINT := 8) IS
185
                    RECORD
186
                         FIELD : SUBINT := DISC;
187
                    END RECORD;
188
               TYPE A1_REC IS ACCESS REC1;
189
               TYPE A2_REC IS NEW A1_REC;
190
               A0 : A1_REC(4) := NEW REC1(4);
191
               CALLED : BOOLEAN := FALSE;
192
 
193
               PROCEDURE P3 (X : IN OUT A2_REC) IS
194
               BEGIN
195
                    CALLED := TRUE;
196
                    X := NEW REC1;
197
               END P3;
198
 
199
          BEGIN
200
               P3 (A2_REC (A0));
201
               IF A0.ALL = REC1'(4,4) THEN
202
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P3 (B1)");
203
               ELSE
204
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P3 (B2)");
205
               END IF;
206
          EXCEPTION
207
               WHEN CONSTRAINT_ERROR =>
208
                    IF NOT CALLED THEN
209
                         FAILED ("EXCEPTION RAISED BEFORE CALL" &
210
                                 "-P1 (B)");
211
                    END IF;
212
               WHEN OTHERS =>
213
                    FAILED ("WRONG EXCEPTION RAISED -P3 (B)");
214
          END;
215
 
216
     END;
217
 
218
     RESULT;
219
END C64103E;

powered by: WebSVN 2.1.0

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