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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a1d2fe1ec5136718 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!news.germany.com!news.belwue.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Generic warning Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Tue, 17 Jun 2008 21:04:38 +0200 Message-ID: NNTP-Posting-Date: 17 Jun 2008 21:04:40 CEST NNTP-Posting-Host: a51fd2e3.newsspool3.arcor-online.net X-Trace: DXC=PQ@OLVJk`f8T2Rfi6[ On Tue, 17 Jun 2008 18:33:42 +0000, S�bastien Morand wrote: >> Maybe it is just a compiler bug. But you should post a complete compilable >> code. No, it is not. The compiler is correct. > Here is a complete code with the same warning: > > procedure Main is > > generic > -- Element to be stored in the btree > type Element (<>) is private; > Order: Positive; > package TestGen is > type ElementPtr is access all Element; > Buffer: array(1 .. Order*2) of ElementPtr; > procedure Store(E: in Element; index: in Positive); > end TestGen; > > package body TestGen is > procedure Store(E: in Element; index: in Positive) is > begin > -- In my real procedure, index is calculated and there is some > -- check. Index can't be > Order*2 > for i in Positive range Order+2 .. index-1 loop The problem is here. You instantiate TestGen with Order = 1. So the upper bound of Buffer is 2. Therefore the range is 1+2..Index, which should cause Constraint_Error in Buffer(I). Bravo GNAT! (Though the warning message could be better) > Buffer(i) := new Element'(E); > end loop; > end Store; > end TestGen; > package IntTestGen is new TestGen( > Element => Integer, > Order => 1 > ); > use IntTestGen; > begin > Store(1, 4); > end Main; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de