comparison gcc/testsuite/ada/acats/tests/l/la140221.am @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 -- LA140221.AM
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 --
26 -- OBJECTIVE:
27 -- Check that a compilation unit may not depend semantically
28 -- on two different versions of the same compilation unit.
29 -- Check the case where a generic instantiation depends on
30 -- a generic procedure that is changed.
31 --
32 -- TEST DESCRIPTION:
33 -- This test compiles a generic procedure, a second generic
34 -- procedure, a generic instantiation of the second procedure
35 -- that depends on both the first and second generic
36 -- procedures, and a main procedure that withs the instantiated
37 -- procedure. Then, a new version of the first generic
38 -- procedure is compiled (in a separate file, simulating
39 -- editing and modification to the unit). Unless automatic
40 -- recompilation is supported, this test should fail to link.
41 -- Otherwise, the test should recompile and link the correct
42 -- version of the withed function and report "PASSED" at
43 -- execution time.
44 --
45 -- SPECIAL REQUIREMENTS:
46 -- To build this test:
47 -- 1) Compile the file LA140220 (and include the results in the
48 -- program library).
49 -- 2) Compile the file LA140221 (and include the results in the
50 -- program library).
51 -- 3) Compile the file LA140222 (and include the results in the
52 -- program library).
53 -- 4) Attempt to build an executable image.
54 -- 5) If an executable image results, run it.
55 --
56 -- TEST FILES:
57 -- This test consists of the following files:
58 -- LA140220.A
59 -- -> LA140221.AM
60 -- LA140222.A
61 --
62 -- PASS/FAIL CRITERIA:
63 -- The test passes if a link time error message reports that
64 -- LA14022_2 is missing or obsolete and no executable image
65 -- results. The test also passes if an executable image is produced
66 -- and reports "PASSED" (in the case where the implementation supports
67 -- automatic recompilation).
68 --
69 -- CHANGE HISTORY:
70 -- 01 MAY 95 ACVC 1.12 LA5008S baseline version
71 -- 23 JUN 95 SAIC Initial version
72 -- 18 NOV 96 SAIC Modified unit names and prologue to conform
73 -- to coding conventions.
74 -- 07 DEC 96 SAIC Moved LA14022_0 to a separate file. Added
75 -- pragma Elaborate to context clause of
76 -- LA14022_2.
77 --
78 --!
79
80 package LA14022_1 is
81 type rec_ptr;
82 type rec is record
83 data : integer;
84 end record;
85 type rec_ptr is access rec;
86 subtype data_int is integer range 0..100;
87 end LA14022_1;
88
89
90 with LA14022_0;
91 with LA14022_1;
92 pragma Elaborate (LA14022_0);
93 procedure LA14022_2 is new
94 LA14022_0 (stuff => LA14022_1.rec,
95 ptr => LA14022_1.rec_ptr,
96 return_result => LA14022_1.data_int,
97 delta_val => 50);
98
99 with Report;
100 use Report;
101 with LA14022_2;
102 with LA14022_1;
103 use LA14022_1;
104 procedure LA140221 is
105 TC_val : LA14022_1.data_int := 10;
106 P, Q : LA14022_1.rec_ptr;
107 begin
108 Test ("LA14022", "Check that a compilation unit may not " &
109 "depend semantically on two different " &
110 "versions of the same compilation unit. " &
111 "Check the case where a generic " &
112 "instantiation depends on a generic " &
113 "procedure that is changed");
114
115 Q := P;
116 LA14022_2 (Q, TC_val);
117
118 if Q /= P then
119 Failed ("Wrong procedure result");
120 end if;
121 if TC_val = 60 then
122 Failed ("Old instantiation used");
123 elsif TC_val /= 10 then
124 Failed ("Wrong result");
125 end if;
126
127 Result;
128 end LA140221;