Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / ada / acats / tests / c5 / c52104a.ada
blobc71408cc3b7127781f1c1b60c95a42e4014958f2
1 -- C52104A.ADA
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.
16 -- DISCLAIMER
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 -- CHECK THAT LENGTHS MUST MATCH IN ARRAY AND SLICE ASSIGNMENTS.
26 -- MORE SPECIFICALLY, TEST THAT ATTEMPTED ASSIGNMENTS BETWEEN
27 -- ARRAYS WITH NON-MATCHING LENGTHS LEAVE THE DESTINATION ARRAY
28 -- INTACT AND CAUSE CONSTRAINT_ERROR TO BE RAISED.
29 -- (OVERLAPS BETWEEN THE OPERANDS OF THE ASSIGNMENT STATEMENT
30 -- ARE TREATED ELSEWHERE.)
32 -- DIVISION A : STATICALLY-DETERMINABLE NON-NULL LENGTHS.
35 -- RM 07/20/81
36 -- SPS 3/22/83
38 WITH REPORT;
39 PROCEDURE C52104A IS
41 USE REPORT ;
43 BEGIN
45 TEST( "C52104A" , "CHECK THAT IN ARRAY ASSIGNMENTS AND IN SLICE" &
46 " ASSIGNMENTS THE LENGTHS MUST MATCH" );
49 -- IN THIS TEST WE CAN'T USE AGGREGATE ASSIGNMENT (EXCEPT WHEN
50 -- THE AGGREGATES ARE STRING LITERALS); THEREFORE:
52 -- (1) ARRAYS WILL BE INITIALIZED BY INDIVIDUAL ASSIGNMENTS;
53 -- (2) CAN'T USE NON-NULL CONSTANT ARRAYS.
56 -- WE ASSUME THAT IN AN ARRAY_TYPE_DEFINITION THE INDEX PORTION
57 -- AND THE COMPONENT_TYPE PORTION ARE FUNCTIONALLY ORTHOGONAL
58 -- ALSO AT THE IMPLEMENTATION LEVEL, I.E. THAT THE CORRECTNESS
59 -- OF THE ACCESSING MECHANISM FOR ARRAYS DOES NOT DEPEND ON
60 -- COMPONENT_TYPE. ACCORDINGLY WE ARE TESTING FOR SOME BUT
61 -- NOT ALL KINDS OF COMPONENT_TYPE. (COMPONENT_TYPES INCLUDED:
62 -- INTEGER , CHARACTER , BOOLEAN .)
65 -- CASES DISTINGUISHED: ( 8 SELECTED CASES ARE IMPLEMENTED)
67 -- ( THE 8 SELECTIONS ARE THE 5-CASE
68 -- SERIES 10-11-12-13-14 FOLLOWED
69 -- BY 7 , 8 , 9 (IN THIS ORDER). )
72 -- ( EACH DIVISION COMPRISES 3 FILES,
73 -- COVERING RESPECTIVELY THE FIRST
74 -- 3 , NEXT 2 , AND LAST 3 OF THE 8
75 -- SELECTIONS FOR THE DIVISION.)
78 -- (1..6) (DO NOT APPLY TO NON-MATCHING OBJECTS, SINCE WE WANT
79 -- THE OBJECTS TO HAVE THE S A M E BASE TYPE.)
82 -- (7) UNSLICED OBJECTS OF THE PREDEFINED TYPE 'STRING' (BY
83 -- THEMSELVES).
86 -- (8) SLICED OBJECTS OF THE PREDEFINED TYPE 'STRING' , WITH
87 -- STRING LITERALS.
90 -- (9) SLICED OBJECTS OF THE PREDEFINED TYPE 'STRING' (BY
91 -- THEMSELVES).
94 -- (-) CONSTRAINABLE TYPES: ONLY SUBTESTS 2, 3, 4, 5, 6
95 -- WILL BE REPLICATED -- AS SUBTESTS 10, 11, 12, 13, 14 .
98 -- (10) MULTIDIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS WERE
99 -- DEFINED USING THE "BOX" COMPOUND SYMBOL.
100 -- (TWO-DIMENSIONAL ARRAYS OF INTEGERS.)
103 -- (11) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
104 -- WERE DEFINED USING THE "BOX" SYMBOL
105 -- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
106 -- ((ONE-DIMENSIONAL) ARRAYS OF INTEGERS.)
109 -- (12) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
110 -- WERE DEFINED USING THE "BOX" SYMBOL
111 -- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
112 -- ((ONE-DIMENSIONAL) ARRAYS OF BOOLEANS.)
115 -- (13) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
116 -- WERE DEFINED USING THE "BOX" SYMBOL
117 -- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
119 -- (STRING LITERALS ARE THE ONLY AGGREGATES WE ARE USING
120 -- IN THIS TEST. TO FORCE SLIDING, THE LOWER LIMIT IMPLIED
121 -- BY THE TYPEMARK WILL NOT BE 1 .)
124 -- (14) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
125 -- WERE DEFINED USING THE "BOX" SYMBOL
126 -- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
130 -- (-) SPECIAL CASES: NULL ARRAYS....... TREATED IN DIVISION B.
131 -- SUPERLONG ARRAYS.. (TREATED FOR DYNAMIC
132 -- ARRAYS ONLY,
133 -- DIVISIONS C AND D .)
136 -- (-) THE DYNAMIC-ARRAY COUNTERPARTS OF THESE TESTS ARE IN DI-
137 -- VISIONS C (FOR NON-NULL ARRAYS) AND D (FOR NULL ARRAYS).
142 -------------------------------------------------------------------
144 -- (1..6: NOT APPLICABLE)
148 -------------------------------------------------------------------
150 -- (10) MULTIDIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS WERE
151 -- DEFINED USING THE "BOX" COMPOUND SYMBOL.
152 -- (TWO-DIMENSIONAL ARRAYS OF INTEGERS.)
154 DECLARE
156 TYPE TABOX0 IS ARRAY( INTEGER RANGE <> , INTEGER RANGE <>
157 ) OF INTEGER ;
159 SUBTYPE TABOX01 IS TABOX0( 1..5 , 0..7 );
160 SUBTYPE TABOX02 IS TABOX0( 0..5 , 2..9 );
162 ARRX01 : TABOX01 ;
163 ARRX02 : TABOX02 ;
165 BEGIN
167 -- INITIALIZATION OF RHS ARRAY:
169 FOR I IN 1..5 LOOP
171 FOR J IN 0..7 LOOP
172 ARRX01( I , J ) := I * I * J ;
173 END LOOP;
175 END LOOP;
178 -- INITIALIZATION OF LHS ARRAY:
180 FOR I IN 0..5 LOOP
182 FOR J IN 2..9 LOOP
183 ARRX02( I , J ) := I * I * J * 3 ;
184 END LOOP;
186 END LOOP;
189 -- ARRAY ASSIGNMENT:
191 ARRX02 := ARRX01 ;
192 FAILED( "EXCEPTION NOT RAISED - SUBTEST 10" );
194 EXCEPTION
196 WHEN CONSTRAINT_ERROR =>
198 -- CHECKING THE VALUES AFTER THE ARRAY ASSIGNMENT:
200 FOR I IN 0..5 LOOP
202 FOR J IN 2..9 LOOP
204 IF ARRX02( I , J ) /= I * I * J * 3
205 THEN
206 FAILED( "ORIG. VALUE ALTERED (10)" );
207 END IF;
209 END LOOP;
211 END LOOP;
213 WHEN OTHERS =>
214 FAILED( "WRONG EXCEPTION RAISED - SUBTEST 10" );
216 END ;
219 -------------------------------------------------------------------
221 -- (11) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
222 -- WERE DEFINED USING THE "BOX" SYMBOL
223 -- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
224 -- ((ONE-DIMENSIONAL) ARRAYS OF INTEGERS.)
226 DECLARE
228 TYPE TABOX1 IS ARRAY( INTEGER RANGE <> ) OF INTEGER ;
230 SUBTYPE TABOX11 IS TABOX1( 1..5 ) ;
232 ARRX11 : TABOX11 ;
233 ARRX12 : TABOX1( 6..9 );
235 BEGIN
237 -- INITIALIZATION OF RHS ARRAY:
239 FOR I IN 1..5 LOOP
241 ARRX11( I ) := I * I ;
243 END LOOP;
246 -- INITIALIZATION OF LHS ARRAY:
248 FOR I IN 6..9 LOOP
249 ARRX12( I ) := I * I * 3 ;
250 END LOOP;
253 -- ARRAY ASSIGNMENT:
255 ARRX12 := ARRX11 ;
256 FAILED( "EXCEPTION NOT RAISED - SUBTEST 11" );
258 EXCEPTION
260 WHEN CONSTRAINT_ERROR =>
262 -- CHECKING THE VALUES AFTER THE ARRAY ASSIGNMENT:
264 FOR I IN 6..9 LOOP
266 IF ARRX12( I ) /= I * I * 3
267 THEN
268 FAILED( "ORIG. VALUE ALTERED (11)" );
269 END IF;
271 END LOOP;
273 WHEN OTHERS =>
274 FAILED( "WRONG EXCEPTION RAISED - SUBTEST 11" );
276 END ;
279 -------------------------------------------------------------------
281 -- (12) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
282 -- WERE DEFINED USING THE "BOX" SYMBOL
283 -- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
284 -- ((ONE-DIMENSIONAL) ARRAYS OF BOOLEANS.)
286 DECLARE
288 TYPE TABOX5 IS ARRAY( INTEGER RANGE <> ) OF BOOLEAN ;
290 SUBTYPE TABOX51 IS TABOX5( 1..5 );
292 ARRX51 : TABOX51 ;
293 ARRX52 : TABOX5( 5..9 );
295 BEGIN
297 -- INITIALIZATION OF LHS ARRAY:
299 FOR I IN 5..9 LOOP
300 ARRX52( I ) := FALSE ;
301 END LOOP;
304 -- INITIALIZATION OF RHS ARRAY:
306 FOR I IN 1..5 LOOP
307 ARRX51( I ) := TRUE ;
308 END LOOP;
311 -- SLICE ASSIGNMENT:
313 ARRX52(6..9) := ARRX51(3..3) ;
314 FAILED( "EXCEPTION NOT RAISED (12)" );
316 EXCEPTION
318 WHEN CONSTRAINT_ERROR =>
320 -- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
322 FOR I IN 5..9 LOOP
324 IF ARRX52( I ) /= FALSE
325 THEN
326 FAILED( "LHS ARRAY ALTERED ( 12 ) " );
327 END IF;
329 END LOOP;
331 WHEN OTHERS =>
332 FAILED( "EXCEPTION RAISED - SUBTEST 12" );
334 END ;
337 -------------------------------------------------------------------
340 RESULT ;
343 END C52104A;