1-- C43205A.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-- CHECK THAT THE BOUNDS OF A POSITIONAL AGGREGATE ARE DETERMINED
26-- CORRECTLY. IN PARTICULAR, CHECK THAT THE LOWER BOUND IS GIVEN BY
27-- 'FIRST OF THE INDEX SUBTYPE WHEN THE POSITIONAL AGGREGATE IS USED AS:
28
29--   A) AN ACTUAL PARAMETER IN A SUBPROGRAM OR ENTRY CALL, AND THE
30--      FORMAL PARAMETER IS UNCONSTRAINED.
31
32-- EG  01/26/84
33
34WITH REPORT;
35
36PROCEDURE C43205A IS
37
38     USE REPORT;
39
40BEGIN
41
42     TEST("C43205A", "CASE A1 : SUBPROGRAM WITH UNCONSTRAINED " &
43                     "ONE-DIMENSIONAL ARRAY FORMAL PARAMETER");
44
45     BEGIN
46
47CASE_A :  BEGIN
48
49     CASE_A1 : DECLARE
50
51                    SUBTYPE STA IS INTEGER RANGE 11 .. 15;
52                    TYPE TA IS ARRAY (STA RANGE <>) OF INTEGER;
53
54                    PROCEDURE PROC1 (A : TA) IS
55                    BEGIN
56                         IF A'FIRST /= IDENT_INT(11) THEN
57                              FAILED ("CASE A1 : LOWER BOUND " &
58                                      "INCORRECTLY GIVEN BY 'FIRST");
59                         ELSIF A'LAST /= 15 THEN
60                              FAILED ("CASE A1 : UPPER BOUND " &
61                                      "INCORRECTLY GIVEN BY 'LAST");
62                         ELSIF A /= (6, 7, 8, 9, 10) THEN
63                              FAILED ("CASE A1 : ARRAY DOES NOT " &
64                                     "CONTAIN THE CORRECT VALUES");
65                         END IF;
66                    END;
67
68               BEGIN
69
70                    PROC1 ((6, 7, 8, 9, IDENT_INT(10)));
71
72               END CASE_A1;
73
74               COMMENT ("CASE A2 : SUBPROGRAM WITH UNCONSTRAINED " &
75                        "TWO-DIMENSIONAL ARRAY FORMAL PARAMETER");
76
77     CASE_A2 : DECLARE
78
79                    SUBTYPE STA1 IS INTEGER RANGE 11 .. IDENT_INT(12);
80                    SUBTYPE STA2 IS INTEGER RANGE 10 .. 11;
81                    TYPE TA IS ARRAY (STA1 RANGE <>, STA2 RANGE <>)
82                                    OF INTEGER;
83
84                    PROCEDURE PROC1 (A : TA) IS
85                    BEGIN
86                         IF A'FIRST(1) /= 11 OR A'FIRST(2) /= 10 THEN
87                              FAILED ("CASE A2 : LOWER BOUND " &
88                                      "INCORRECTLY GIVEN BY 'FIRST");
89                         ELSIF A'LAST(1) /= 12 OR
90                               A'LAST(2) /= IDENT_INT(11) THEN
91                              FAILED ("CASE A2 : UPPER BOUND " &
92                                      "INCORRECTLY GIVEN BY 'LAST");
93                         ELSIF A /= ((1, 2), (3, 4)) THEN
94                              FAILED ("CASE A2 : ARRAY DOES NOT " &
95                                     "CONTAIN THE CORRECT VALUES");
96                         END IF;
97                    END;
98
99               BEGIN
100
101                    PROC1 (((1, 2), (IDENT_INT(3), 4)));
102
103               END CASE_A2;
104
105          END CASE_A;
106
107     END;
108
109     RESULT;
110
111END C43205A;
112