summaryrefslogtreecommitdiff
path: root/gcc/testsuite/ada/acats/tests/c3/c36204d.ada
blob: afdadbf53b8fe880dd2c26f51f6acbf08fd4ef23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
-- C36204D.ADA

--                             Grant of Unlimited Rights
--
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained 
--     unlimited rights in the software and documentation contained herein.
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making 
--     this public release, the Government intends to confer upon all 
--     recipients unlimited rights  equal to those held by the Government.  
--     These rights include rights to use, duplicate, release or disclose the 
--     released technical data and computer software in whole or in part, in 
--     any manner and for any purpose whatsoever, and to have or permit others 
--     to do so.
--
--                                    DISCLAIMER
--
--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED 
--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE 
--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--     PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT EACH ARRAY ATTRIBUTE YIELDS THE CORRECT VALUES.
-- BOTH ARRAY OBJECTS AND TYPES ARE CHECKED. THIS TEST CHECKS 
-- THE ABOVE FOR ARRAYS WITHIN GENERIC PROGRAM UNITS.

-- HISTROY
--  EDWARD V. BERARD, 9 AUGUST 1990

WITH REPORT ;
WITH SYSTEM ;

PROCEDURE C36204D IS

    SHORT_START : CONSTANT := -10 ;
    SHORT_END    : CONSTANT := 10 ;
    TYPE SHORT_RANGE IS RANGE SHORT_START .. SHORT_END ;
    SHORT_LENGTH : CONSTANT NATURAL := (SHORT_END - SHORT_START + 1) ;
    
    TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
                        SEP, OCT, NOV, DEC) ;
    SUBTYPE MID_YEAR IS MONTH_TYPE RANGE MAY .. AUG ;
    TYPE DAY_TYPE IS RANGE 1 .. 31 ;
    TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
    TYPE DATE IS RECORD
      MONTH : MONTH_TYPE ;
      DAY   : DAY_TYPE ;
      YEAR  : YEAR_TYPE ;
    END RECORD ;
    
    TODAY         : DATE := (MONTH => AUG,
                             DAY   => 10,
                             YEAR  => 1990) ;
                            
    FIRST_DATE     : DATE := (DAY   => 6,
                              MONTH => JUN,
                              YEAR  => 1967) ;
                            
    FUNCTION "=" (LEFT  : IN SYSTEM.ADDRESS ;
                  RIGHT : IN SYSTEM.ADDRESS ) RETURN BOOLEAN
            RENAMES SYSTEM."=" ;

    GENERIC
    
        TYPE FIRST_INDEX IS (<>) ;
        FIRST_INDEX_LENGTH : IN NATURAL ;
        FIRST_TEST_VALUE : IN FIRST_INDEX ;
        TYPE SECOND_INDEX IS (<>) ;
        SECOND_INDEX_LENGTH : IN NATURAL ;
        SECOND_TEST_VALUE : IN SECOND_INDEX ;
        TYPE THIRD_INDEX IS (<>) ;
        THIRD_INDEX_LENGTH : IN NATURAL ;
        THIRD_TEST_VALUE : IN THIRD_INDEX ;
        TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
        FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
        SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
        TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
        THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
        FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
    
    PACKAGE ARRAY_ATTRIBUTE_TEST IS
    
        TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
            OF FIRST_COMPONENT_TYPE ;
            
        TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
            OF SECOND_COMPONENT_TYPE ;
            
    END ARRAY_ATTRIBUTE_TEST ;
    
    PACKAGE BODY ARRAY_ATTRIBUTE_TEST IS
    
        FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                                (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                                    FIRST_DEFAULT_VALUE)) ;
        
        SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                               (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                               (THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
                                       THIRD_DEFAULT_VALUE))) ;
                                    
        THIRD_ARRAY : CONSTANT MATRIX 
                             := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                                (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                                    SECOND_DEFAULT_VALUE)) ;
                                        
        FOURTH_ARRAY : CONSTANT CUBE 
                            := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                               (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                               (THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
                                       FOURTH_DEFAULT_VALUE))) ;
                                    
        FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
        FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
        FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
        FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
        
        SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
        SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
        SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
        SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
        SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
        SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
        
        FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
        FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
        
        SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
        SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
        SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
        
        MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
        CUBE_SIZE    : NATURAL := CUBE'SIZE ;
        
        FAA  : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
        SAA  : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
        TAA  : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
        FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
             
     BEGIN  -- ARRAY_ATTRIBUTE_TEST
     
        IF (FA1 /= FIRST_INDEX'FIRST) OR
           (FA3 /= SECOND_INDEX'FIRST) OR
           (SA1 /= FIRST_INDEX'FIRST) OR
           (SA3 /= SECOND_INDEX'FIRST) OR
           (SA5 /= THIRD_INDEX'FIRST) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST - PACKAGE") ;
        END IF ;
        
        IF (FA2 /= FIRST_INDEX'LAST) OR
           (FA4 /= SECOND_INDEX'LAST) OR
           (SA2 /= FIRST_INDEX'LAST) OR
           (SA4 /= SECOND_INDEX'LAST) OR
           (SA6 /= THIRD_INDEX'LAST) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST - PACKAGE") ;
        END IF ;
        
        IF (FAL1 /= FIRST_INDEX_LENGTH) OR
           (FAL2 /= SECOND_INDEX_LENGTH) OR
           (SAL1 /= FIRST_INDEX_LENGTH) OR
           (SAL2 /= SECOND_INDEX_LENGTH) OR
           (SAL3 /= THIRD_INDEX_LENGTH) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH - PACKAGE") ;
        END IF ;
        
        FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
            FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
                FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
                    SECOND_DEFAULT_VALUE ;
            END LOOP ;
        END LOOP ;
        
        IF FIRST_ARRAY /= THIRD_ARRAY THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "FOR 2-DIMENSIONAL ARRAY. - PACKAGE") ;
        END IF ;
        
        FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
            FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
                FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
                    SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
                        := FOURTH_DEFAULT_VALUE ;
                END LOOP ;
            END LOOP ;
        END LOOP ;
        
        IF SECOND_ARRAY /= FOURTH_ARRAY THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "FOR 3-DIMENSIONAL ARRAY. - PACKAGE") ;
        END IF ;
        
        IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
           (FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
           (SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
           (SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
           (THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "- PACKAGE") ;
        END IF ;
        
        IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
                           "- PACKAGE") ;
        END IF ;
        
        IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
           OR (SAA = TAA) OR (TAA = FRAA) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
                           "- PACKAGE") ;
        END IF ;
        
    END ARRAY_ATTRIBUTE_TEST ;

    GENERIC
    
        TYPE FIRST_INDEX IS (<>) ;
        FIRST_INDEX_LENGTH : IN NATURAL ;
        FIRST_TEST_VALUE : IN FIRST_INDEX ;
        TYPE SECOND_INDEX IS (<>) ;
        SECOND_INDEX_LENGTH : IN NATURAL ;
        SECOND_TEST_VALUE : IN SECOND_INDEX ;
        TYPE THIRD_INDEX IS (<>) ;
        THIRD_INDEX_LENGTH : IN NATURAL ;
        THIRD_TEST_VALUE : IN THIRD_INDEX ;
        TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
        FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
        SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
        TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
        THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
        FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
        
    PROCEDURE PROC_ARRAY_ATT_TEST ;
    
    PROCEDURE PROC_ARRAY_ATT_TEST IS
    
        TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
            OF FIRST_COMPONENT_TYPE ;
            
        TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
            OF SECOND_COMPONENT_TYPE ;
            
        FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                                (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                                    FIRST_DEFAULT_VALUE)) ;
        
        SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                               (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                               (THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
                                       THIRD_DEFAULT_VALUE))) ;
                                    
        THIRD_ARRAY : CONSTANT MATRIX 
                             := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                                (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                                    SECOND_DEFAULT_VALUE)) ;
                                        
        FOURTH_ARRAY : CONSTANT CUBE 
                            := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                               (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                               (THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
                                       FOURTH_DEFAULT_VALUE))) ;
                                    
        FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
        FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
        FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
        FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
        
        SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
        SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
        SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
        SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
        SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
        SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
        
        FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
        FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
        
        SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
        SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
        SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
        
        MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
        CUBE_SIZE    : NATURAL := CUBE'SIZE ;
        
        FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
        SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
        TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
        FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
             
     BEGIN  -- PROC_ARRAY_ATT_TEST

        IF (FA1 /= FIRST_INDEX'FIRST) OR
           (FA3 /= SECOND_INDEX'FIRST) OR
           (SA1 /= FIRST_INDEX'FIRST) OR
           (SA3 /= SECOND_INDEX'FIRST) OR
           (SA5 /= THIRD_INDEX'FIRST) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST " &
                           "- PROCEDURE") ;
        END IF ;
        
        IF (FA2 /= FIRST_INDEX'LAST) OR
           (FA4 /= SECOND_INDEX'LAST) OR
           (SA2 /= FIRST_INDEX'LAST) OR
           (SA4 /= SECOND_INDEX'LAST) OR
           (SA6 /= THIRD_INDEX'LAST) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST " &
                           "- PROCEDURE") ;
        END IF ;
        
        IF (FAL1 /= FIRST_INDEX_LENGTH) OR
           (FAL2 /= SECOND_INDEX_LENGTH) OR
           (SAL1 /= FIRST_INDEX_LENGTH) OR
           (SAL2 /= SECOND_INDEX_LENGTH) OR
           (SAL3 /= THIRD_INDEX_LENGTH) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH " &
                           "- PROCEDURE") ;
        END IF ;
        
        FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
            FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
                FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
                    SECOND_DEFAULT_VALUE ;
            END LOOP ;
        END LOOP ;
        
        IF FIRST_ARRAY /= THIRD_ARRAY THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "FOR 2-DIMENSIONAL ARRAY. - PROCEDURE") ;
        END IF ;
        
        FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
            FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
                FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
                    SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
                        := FOURTH_DEFAULT_VALUE ;
                END LOOP ;
            END LOOP ;
        END LOOP ;
        
        IF SECOND_ARRAY /= FOURTH_ARRAY THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "FOR 3-DIMENSIONAL ARRAY. - PROCEDURE") ;
        END IF ;
        
        IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
           (FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
           (SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
           (SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
           (THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "- PROCEDURE") ;
        END IF ;
        
        IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
                           "- PROCEDURE") ;
        END IF ;
        
        IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
           OR (SAA = TAA) OR (TAA = FRAA) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
                           "- PROCEDURE") ;
        END IF ;
        
    END PROC_ARRAY_ATT_TEST ;

    GENERIC
    
        TYPE FIRST_INDEX IS (<>) ;
        FIRST_INDEX_LENGTH : IN NATURAL ;
        FIRST_TEST_VALUE : IN FIRST_INDEX ;
        TYPE SECOND_INDEX IS (<>) ;
        SECOND_INDEX_LENGTH : IN NATURAL ;
        SECOND_TEST_VALUE : IN SECOND_INDEX ;
        TYPE THIRD_INDEX IS (<>) ;
        THIRD_INDEX_LENGTH : IN NATURAL ;
        THIRD_TEST_VALUE : IN THIRD_INDEX ;
        TYPE FIRST_COMPONENT_TYPE IS PRIVATE ;
        FIRST_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
        SECOND_DEFAULT_VALUE : IN FIRST_COMPONENT_TYPE ;
        TYPE SECOND_COMPONENT_TYPE IS PRIVATE ;
        THIRD_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
        FOURTH_DEFAULT_VALUE : IN SECOND_COMPONENT_TYPE ;
        
    FUNCTION FUNC_ARRAY_ATT_TEST RETURN BOOLEAN ;
    
    FUNCTION FUNC_ARRAY_ATT_TEST RETURN BOOLEAN IS
    
        TYPE MATRIX IS ARRAY (FIRST_INDEX, SECOND_INDEX)
            OF FIRST_COMPONENT_TYPE ;
            
        TYPE CUBE IS ARRAY (FIRST_INDEX, SECOND_INDEX, THIRD_INDEX)
            OF SECOND_COMPONENT_TYPE ;
            
        FIRST_ARRAY : MATRIX := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                                (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                                    FIRST_DEFAULT_VALUE)) ;
        
        SECOND_ARRAY : CUBE := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                               (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                               (THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
                                       THIRD_DEFAULT_VALUE))) ;
                                    
        THIRD_ARRAY : CONSTANT MATRIX 
                             := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                                (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                                    SECOND_DEFAULT_VALUE)) ;
                                        
        FOURTH_ARRAY : CONSTANT CUBE 
                            := (FIRST_INDEX'FIRST .. FIRST_INDEX'LAST =>
                               (SECOND_INDEX'FIRST .. SECOND_INDEX'LAST =>
                               (THIRD_INDEX'FIRST .. THIRD_INDEX'LAST =>
                                       FOURTH_DEFAULT_VALUE))) ;
                                    
        FA1 : FIRST_INDEX := FIRST_ARRAY'FIRST (1) ;
        FA2 : FIRST_INDEX := FIRST_ARRAY'LAST (1) ;
        FA3 : SECOND_INDEX := FIRST_ARRAY'FIRST (2) ;
        FA4 : SECOND_INDEX := FIRST_ARRAY'LAST (2) ;
        
        SA1 : FIRST_INDEX := SECOND_ARRAY'FIRST (1) ;
        SA2 : FIRST_INDEX := SECOND_ARRAY'LAST (1) ;
        SA3 : SECOND_INDEX := SECOND_ARRAY'FIRST (2) ;
        SA4 : SECOND_INDEX := SECOND_ARRAY'LAST (2) ;
        SA5 : THIRD_INDEX := SECOND_ARRAY'FIRST (3) ;
        SA6 : THIRD_INDEX := SECOND_ARRAY'LAST (3) ;
        
        FAL1 : NATURAL := FIRST_ARRAY'LENGTH (1) ;
        FAL2 : NATURAL := FIRST_ARRAY'LENGTH (2) ;
        
        SAL1 : NATURAL := SECOND_ARRAY'LENGTH (1) ;
        SAL2 : NATURAL := SECOND_ARRAY'LENGTH (2) ;
        SAL3 : NATURAL := SECOND_ARRAY'LENGTH (3) ;
        
        MATRIX_SIZE : NATURAL := MATRIX'SIZE ;
        CUBE_SIZE    : NATURAL := CUBE'SIZE ;
        
        FAA : SYSTEM.ADDRESS := FIRST_ARRAY'ADDRESS ;
        SAA : SYSTEM.ADDRESS := SECOND_ARRAY'ADDRESS ;
        TAA : SYSTEM.ADDRESS := THIRD_ARRAY'ADDRESS ;
        FRAA : SYSTEM.ADDRESS := FOURTH_ARRAY'ADDRESS ;
             
     BEGIN  -- FUNC_ARRAY_ATT_TEST

        IF (FA1 /= FIRST_INDEX'FIRST) OR
           (FA3 /= SECOND_INDEX'FIRST) OR
           (SA1 /= FIRST_INDEX'FIRST) OR
           (SA3 /= SECOND_INDEX'FIRST) OR
           (SA5 /= THIRD_INDEX'FIRST) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'FIRST " &
                           "- FUNCTION") ;
        END IF ;
        
        IF (FA2 /= FIRST_INDEX'LAST) OR
           (FA4 /= SECOND_INDEX'LAST) OR
           (SA2 /= FIRST_INDEX'LAST) OR
           (SA4 /= SECOND_INDEX'LAST) OR
           (SA6 /= THIRD_INDEX'LAST) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LAST " &
                           "- FUNCTION") ;
        END IF ;
        
        IF (FAL1 /= FIRST_INDEX_LENGTH) OR
           (FAL2 /= SECOND_INDEX_LENGTH) OR
           (SAL1 /= FIRST_INDEX_LENGTH) OR
           (SAL2 /= SECOND_INDEX_LENGTH) OR
           (SAL3 /= THIRD_INDEX_LENGTH) THEN
            REPORT.FAILED ("INCORRECT VALUE RETURNED FOR 'LENGTH " &
                           "- FUNCTION") ;
        END IF ;
        
        FOR OUTER_INDEX IN FIRST_ARRAY'RANGE (1) LOOP
            FOR INNER_INDEX IN FIRST_ARRAY'RANGE (2) LOOP
                FIRST_ARRAY (OUTER_INDEX, INNER_INDEX) :=
                    SECOND_DEFAULT_VALUE ;
            END LOOP ;
        END LOOP ;
        
        IF FIRST_ARRAY /= THIRD_ARRAY THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "FOR 2-DIMENSIONAL ARRAY. - FUNCTION") ;
        END IF ;
        
        FOR OUTER_INDEX IN SECOND_ARRAY'RANGE (1) LOOP
            FOR MIDDLE_INDEX IN SECOND_ARRAY'RANGE (2) LOOP
                FOR INNER_INDEX IN SECOND_ARRAY'RANGE (3) LOOP
                    SECOND_ARRAY (OUTER_INDEX, MIDDLE_INDEX, INNER_INDEX)
                        := FOURTH_DEFAULT_VALUE ;
                END LOOP ;
            END LOOP ;
        END LOOP ;
        
        IF SECOND_ARRAY /= FOURTH_ARRAY THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "FOR 3-DIMENSIONAL ARRAY. - FUNCTION") ;
        END IF ;
        
        IF (FIRST_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (1)) OR
           (FIRST_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (1)) OR
           (SECOND_TEST_VALUE NOT IN FIRST_ARRAY'RANGE (2)) OR
           (SECOND_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (2)) OR
           (THIRD_TEST_VALUE NOT IN SECOND_ARRAY'RANGE (3)) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE ATTRIBUTE " &
                           "- FUNCTION") ;
        END IF ;
        
        IF (MATRIX_SIZE = 0) OR (CUBE_SIZE = 0) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF THE 'SIZE ATTRIBUTE. " &
                           "- FUNCTION") ;
        END IF ;
        
        IF (FAA = TAA) OR (SAA = FRAA) OR (FAA = SAA) OR (FAA = FRAA)
           OR (SAA = TAA) OR (TAA = FRAA) THEN
            REPORT.FAILED ("INCORRECT HANDLING OF THE 'ADDRESS ATTRIBUTE. " &
                           "- FUNCTION") ;
        END IF ;
        
        RETURN TRUE ;
        
    END FUNC_ARRAY_ATT_TEST ;


BEGIN -- C36204D

    REPORT.TEST ("C36204D", "ARRAY ATTRIBUTES RETURN CORRECT " &
                  "VALUES WITHIN GENERIC PROGRAM UNITS.") ;
     
    LOCAL_BLOCK:
    
    DECLARE
    
        DUMMY : BOOLEAN := FALSE ;
    
        PACKAGE NEW_ARRAY_ATTRIBUTE_TEST IS NEW ARRAY_ATTRIBUTE_TEST (
            FIRST_INDEX             => SHORT_RANGE,
            FIRST_INDEX_LENGTH      => SHORT_LENGTH,
            FIRST_TEST_VALUE        => -7,
            SECOND_INDEX            => MONTH_TYPE,
            SECOND_INDEX_LENGTH     => 12,
            SECOND_TEST_VALUE       => AUG,
            THIRD_INDEX             => BOOLEAN,
            THIRD_INDEX_LENGTH      => 2,
            THIRD_TEST_VALUE        => FALSE,
            FIRST_COMPONENT_TYPE    => MONTH_TYPE,
            FIRST_DEFAULT_VALUE     => JAN,
            SECOND_DEFAULT_VALUE    => DEC,
            SECOND_COMPONENT_TYPE   => DATE,
            THIRD_DEFAULT_VALUE     => TODAY,
            FOURTH_DEFAULT_VALUE    => FIRST_DATE) ;
        
        PROCEDURE NEW_PROC_ARRAY_ATT_TEST IS NEW PROC_ARRAY_ATT_TEST (
            FIRST_INDEX             => MONTH_TYPE,
            FIRST_INDEX_LENGTH      => 12,
            FIRST_TEST_VALUE        => AUG,
            SECOND_INDEX            => SHORT_RANGE,
            SECOND_INDEX_LENGTH     => SHORT_LENGTH,
            SECOND_TEST_VALUE       => -7,
            THIRD_INDEX             => BOOLEAN,
            THIRD_INDEX_LENGTH      => 2,
            THIRD_TEST_VALUE        => FALSE,
            FIRST_COMPONENT_TYPE    => DATE,
            FIRST_DEFAULT_VALUE     => TODAY,
            SECOND_DEFAULT_VALUE    => FIRST_DATE,
            SECOND_COMPONENT_TYPE   => MONTH_TYPE,
            THIRD_DEFAULT_VALUE     => JAN,
            FOURTH_DEFAULT_VALUE    => DEC) ;

        FUNCTION NEW_FUNC_ARRAY_ATT_TEST IS NEW FUNC_ARRAY_ATT_TEST (
            FIRST_INDEX             => DAY_TYPE,
            FIRST_INDEX_LENGTH      => 31,
            FIRST_TEST_VALUE        => 25,
            SECOND_INDEX            => SHORT_RANGE,
            SECOND_INDEX_LENGTH     => SHORT_LENGTH,
            SECOND_TEST_VALUE       => -7,
            THIRD_INDEX             => MID_YEAR,
            THIRD_INDEX_LENGTH      => 4,
            THIRD_TEST_VALUE        => JUL,
            FIRST_COMPONENT_TYPE    => DATE,
            FIRST_DEFAULT_VALUE     => TODAY,
            SECOND_DEFAULT_VALUE    => FIRST_DATE,
            SECOND_COMPONENT_TYPE   => MONTH_TYPE,
            THIRD_DEFAULT_VALUE     => JAN,
            FOURTH_DEFAULT_VALUE    => DEC) ;

    BEGIN  -- LOCAL_BLOCK
    
        NEW_PROC_ARRAY_ATT_TEST ;
        
        DUMMY := NEW_FUNC_ARRAY_ATT_TEST ;
        IF NOT DUMMY THEN
            REPORT.FAILED ("WRONG VALUE RETURNED BY FUNCTION.") ;
        END IF ;
        
    END LOCAL_BLOCK ;
     
    REPORT.RESULT ;
     
END C36204D ;