From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Elaboration in generic package Date: Thu, 13 Apr 2017 08:19:01 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="282876be9c343f4be57f19b4306c15d9"; logging-data="26776"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+H/ZWA3gGZqXP0ya3wq6K4lMjMCs8nze4=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cancel-Lock: sha1:T9anAcZB29CQPMxTMjSoyCrBbI4= sha1:3iaO0osRxuL77zpDzACfLex2JLE= Xref: news.eternal-september.org comp.lang.ada:46583 Date: 2017-04-13T08:19:01+01:00 List-Id: "Randy Brukardt" writes: > Since Ada elaborates items linearly, the instance elaboration of > Mystic will call reallyComplicatedFunction before Seed is elaborated > -- meaning the body would be depending on something > uninitialized. That's what subprogram elaboration checks are designed > to prevent. Ergo, there must be a check in this case (regardless of > the actual body, of course). I tried this simple demo package body Mystic is Max : Positive; function reallyComplicatedFunction(x : Positive) return Table is Result : Table (1 .. Positive'Min (X, Max) / 2) := (others => 1); begin return Result; end ReallyComplicatedFunction; begin Max := 5; end Mystic; and, surprise, the value of Max used is 0; no warnings, no ABE, even with -gnatE. Bug report forthcoming. Thanks for the analysis.