1-- C64104M.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 CONSTRAINT_ERROR IS RAISED UNDER THE APPROPRIATE
26--   CIRCUMSTANCES FOR ACCESS PARAMETERS, NAMELY WHEN THE
27--   ACTUAL INDEX BOUNDS OR DISCRIMINANTS ARE NOT EQUAL
28--   TO THE FORMAL CONSTRAINTS BEFORE THE CALL (FOR IN AND IN OUT
29--   MODES), AND WHEN THE FORMAL CONSTRAINTS ARE NOT EQUAL TO THE
30--   ACTUAL CONSTRAINTS UPON RETURN (FOR IN OUT AND OUT MODES).
31
32--       (J) AFTER RETURN, OUT MODE, CONSTRAINED FORMAL, DYNAMIC TWO
33--           DIMENSIONAL BOUNDS.
34
35-- JRK 3/18/81
36-- NL 10/13/81
37-- SPS 10/26/82
38
39WITH REPORT;
40PROCEDURE C64104M IS
41
42     USE REPORT;
43
44BEGIN
45     TEST ("C64104M", "CHECK THAT CONSTRAINT_ERROR IS RAISED " &
46           "APPROPRIATELY FOR ACCESS PARAMETERS");
47
48     --------------------------------------------------
49
50     DECLARE
51
52          TYPE T IS ARRAY (INTEGER RANGE <>,
53                           CHARACTER RANGE <>
54                          ) OF INTEGER;
55
56          TYPE A IS ACCESS T;
57
58          V : A (1..10, 'A'..'Z') := NEW T (1..10, 'A'..'Z');
59
60          ENTERED : BOOLEAN := FALSE;
61          Y : CONSTANT CHARACTER := IDENT_CHAR('Y');
62          SUBTYPE SA IS A(1..10, 'A'..Y);
63          PROCEDURE P (X : OUT SA ) IS
64          BEGIN
65               ENTERED := TRUE;
66               X := NEW T (1..10, 'A'..IDENT_CHAR('Y'));
67          EXCEPTION
68               WHEN OTHERS =>
69                    FAILED ("EXCEPTION RAISED IN PROCEDURE");
70          END P;
71
72     BEGIN
73
74          P (V);
75          FAILED ("EXCEPTION NOT RAISED AFTER RETURN");
76
77     EXCEPTION
78          WHEN CONSTRAINT_ERROR =>
79               IF NOT ENTERED THEN
80                    FAILED ("CONSTRAINT_ERROR RAISED BEFORE " &
81                            "CALL");
82               END IF;
83          WHEN OTHERS =>
84               IF NOT ENTERED THEN
85                    FAILED ("OTHER EXCEPTION RAISED BEFORE CALL");
86               ELSE FAILED ("WRONG EXCEPTION RAISED AFTER " &
87                            "RETURN");
88               END IF;
89     END;
90
91     --------------------------------------------------
92
93     RESULT;
94
95END C64104M;
96