1-- LA140182.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 separate generic package body depends
30--      on a library level generic package body that is changed.
31--
32-- TEST DESCRIPTION:
33--      This test compiles a generic package and its body, and a
34--      procedure that withs the generic package.  Then a new
35--      version of the generic package body is compiled (in a
36--      separate file, simulating and editing modification to the
37--      unit).  Unless automatic recompilation is supported, this
38--      test should fail to link.  Otherwise, the test should
39--      recompile and link the correct version of the with package
40--      withed package and report "PASSED" at execution time.
41--
42-- SPECIAL REQUIREMENTS:
43--      To build this test:
44--         1) Compile the file LA140180 (and include the results in the
45--            program library).
46--         2) Compile the file LA140181 (and include the results in the
47--            program library).
48--         3) Compile the file LA140182 (and include the results in the
49--            program library).
50--         4) Compile the file LA140183 (and include the results in the
51--            program library).
52--         5) Attempt to build an executable image.
53--         6) If an executable image results, run it.
54--
55-- TEST FILES:
56--      This test consists of the following files:
57--         LA140180.A
58--         LA140181.A
59--      -> LA140182.AM
60--         LA140183.A
61--
62-- PASS/FAIL CRITERIA:
63--      The test passes if a link time error message reports that
64--      LA14018_0.utils_18 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--
70-- CHANGE HISTORY:
71--     01 MAY 95   ACVC 1.12   LA5008N baseline version
72--     16 JUN 95   SAIC        Initial version
73--     07 DEC 96   SAIC        Modified unit names and prologue to conform
74--                             to coding conventions. Moved instantiation
75--                             of utils_18 to avoid potential Program_Error.
76--                             Moved LA14018_0 to a separate file.
77--
78--!
79
80separate (LA14018_0)        -- This dependency must be resolved
81                            -- after LA140181.A is compiled.
82package body utils_18 is
83     procedure Dec (Param : in out unsigned) is
84     begin
85          Param := Param - offset;
86     end Dec;
87end utils_18;
88
89--------------------------------------------------------
90
91with Report; use Report;
92with LA14018_0;
93procedure LA140182 is
94     type mod_4 is mod 4; -- 0, 1, 2, 3, 0, 1,...
95     TC_var : mod_4 := 2;
96
97     package Mod_stuff is new LA14018_0 (mod_4);
98     package unsigned_utils is new Mod_stuff.utils_18 (mod_4);
99begin
100     Test ("LA14018", "Check that a compilation unit may not " &
101                      "depend semantically on two different " &
102                      "versions of the same compilation unit. "&
103                      "Check the case where a separate package " &
104                      "body depends on a library level generic " &
105                      "package body that is changed");
106
107     unsigned_utils.Dec (TC_var);
108
109     if TC_var = 2 then
110          Failed ("Dec routine did not work");
111     elsif TC_var = 1 then
112          Failed ("New body for LA14018_0 not used");
113     elsif TC_var /= 3 then
114          Failed ("Unexpected result produced");
115     end if;
116
117     Result;
118end LA140182;
119