Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / ada / acats / tests / c6 / c62002a.ada
blobf15bca7d278b1344de9347845237998341b40a88
1 -- C62002A.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 THE COMPONENTS OF ACCESS IN PARAMETERS CAN BE USED AS THE
26 -- TARGET OF AN ASSIGNMENT STATEMENT OR AS AN ACTUAL PARAMETER OF
27 -- ANY MODE. SUBTESTS ARE:
28 -- (A) INTEGER ACCESS TYPE.
29 -- (B) ARRAY ACCESS TYPE.
30 -- (C) RECORD ACCESS TYPE.
32 -- DAS 1/23/81
33 -- SPS 10/26/82
35 WITH REPORT;
36 PROCEDURE C62002A IS
38 USE REPORT;
40 BEGIN
42 TEST ("C62002A", "CHECK THAT COMPONENTS OF ACCESS IN PARAMETERS" &
43 " MAY BE USED IN ASSIGNMENT CONTEXTS");
45 --------------------------------------------------
47 DECLARE -- (A)
49 TYPE PTRINT IS ACCESS INTEGER;
50 PI : PTRINT;
52 PROCEDURE PROCA (PI : IN PTRINT) IS
54 PROCEDURE PROCA1 (I : OUT INTEGER) IS
55 BEGIN
56 I := 7;
57 END PROCA1;
59 PROCEDURE PROCA2 (I : IN OUT INTEGER) IS
60 BEGIN
61 I := I + 1;
62 END PROCA2;
63 BEGIN
65 PROCA1 (PI.ALL);
66 PROCA2 (PI.ALL);
67 PI.ALL := PI.ALL + 1;
68 IF (PI.ALL /= 9) THEN
69 FAILED ("ASSIGNMENT TO COMPONENT OF INTEGER" &
70 " ACCESS PARAMETER FAILED");
71 END IF;
72 END PROCA;
74 BEGIN -- (A)
76 PI := NEW INTEGER '(0);
77 PROCA (PI);
79 END; -- (A)
81 ---------------------------------------------
83 DECLARE -- (B)
85 TYPE TBL IS ARRAY (1..3) OF INTEGER;
86 TYPE PTRTBL IS ACCESS TBL;
87 PT : PTRTBL;
89 PROCEDURE PROCB (PT : IN PTRTBL) IS
91 PROCEDURE PROCB1 (I : OUT INTEGER) IS
92 BEGIN
93 I := 7;
94 END PROCB1;
96 PROCEDURE PROCB2 (I : IN OUT INTEGER) IS
97 BEGIN
98 I := I + 1;
99 END PROCB2;
101 PROCEDURE PROCB3 (T : OUT TBL) IS
102 BEGIN
103 T := (1,2,3);
104 END PROCB3;
106 PROCEDURE PROCB4 (T : IN OUT TBL) IS
107 BEGIN
108 T(3) := T(3) - 1;
109 END PROCB4;
111 BEGIN
113 PROCB3 (PT.ALL); -- (1,2,3)
114 PROCB4 (PT.ALL); -- (1,2,2)
115 PROCB1 (PT(2)); -- (1,7,2)
116 PROCB2 (PT(1)); -- (2,7,2)
117 PT(3) := PT(3) + 7; -- (2,7,9)
118 IF (PT.ALL /= (2,7,9)) THEN
119 FAILED ("ASSIGNMENT TO COMPONENT OF ARRAY" &
120 " ACCESS PARAMETER FAILED");
121 END IF;
122 END PROCB;
124 BEGIN -- (B)
126 PT := NEW TBL '(0,0,0);
127 PROCB (PT);
129 END; -- (B)
131 ---------------------------------------------
133 DECLARE -- (C)
135 TYPE REC IS
136 RECORD
137 I1 : INTEGER;
138 I2 : INTEGER;
139 I3 : INTEGER;
140 END RECORD;
141 TYPE PTRREC IS ACCESS REC;
142 PR : PTRREC;
144 PROCEDURE PROCC (PR : IN PTRREC) IS
146 PROCEDURE PROCC1 (I : OUT INTEGER) IS
147 BEGIN
148 I := 7;
149 END PROCC1;
151 PROCEDURE PROCC2 (I : IN OUT INTEGER) IS
152 BEGIN
153 I := I + 1;
154 END PROCC2;
156 PROCEDURE PROCC3 (R : OUT REC) IS
157 BEGIN
158 R := (1,2,3);
159 END PROCC3;
161 PROCEDURE PROCC4 (R : IN OUT REC) IS
162 BEGIN
163 R.I3 := R.I3 - 1;
164 END PROCC4;
166 BEGIN
168 PROCC3 (PR.ALL); -- (1,2,3)
169 PROCC4 (PR.ALL); -- (1,2,2)
170 PROCC1 (PR.I2); -- (1,7,2)
171 PROCC2 (PR.I1); -- (2,7,2)
172 PR.I3 := PR.I3 + 7; -- (2,7,9)
173 IF (PR.ALL /= (2,7,9)) THEN
174 FAILED ("ASSIGNMENT TO COMPONENT OF RECORD" &
175 " ACCESS PARAMETER FAILED");
176 END IF;
177 END PROCC;
179 BEGIN -- (C)
181 PR := NEW REC '(0,0,0);
182 PROCC (PR);
184 END; -- (C)
186 ---------------------------------------------
188 RESULT;
190 END C62002A;