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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bdebc54a485c13a4 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.236.170 with SMTP id uv10mr1913331pbc.4.1332538442257; Fri, 23 Mar 2012 14:34:02 -0700 (PDT) Path: kz5ni25703pbc.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: My first compiler bug: work around or redesign? Date: Fri, 23 Mar 2012 21:34:01 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <10kx1zr05qt9s$.ab8q1peu0ukt.dlg@40tude.net> Mime-Version: 1.0 Injection-Date: Fri, 23 Mar 2012 21:34:01 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="Mda950WjNwNLAFOE7yJXQw"; logging-data="13540"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ynQoBUlF6W81QofgJ5jts" User-Agent: slrn/0.9.9p1 (FreeBSD) Cancel-Lock: sha1:S8Dvv5PK6SHRpg+57cBWKpKyAwk= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: 2012-03-23T21:34:01+00:00 List-Id: On 2012-03-23, Dmitry A. Kazakov wrote: > On Fri, 23 Mar 2012 16:29:06 +0000 (UTC), Natasha Kerensikova wrote: > >> I happen to have encountered my very first compiler bug, or at least >> something that claims to be in the following message > > First, make sure your code is legal. In some cases GNAT crashes when > detects an error in the program. One method to find the problem is to > comment offending source code lines until it compiles and then twist it > this or that way. I tried that method, until there was so much to remove that nothing made sense anymore. As far as I can tell, any "local" generic instantiation in that package triggers the compiler error. Surprisingly (at least for me), the error is triggered on the first instantiation, even though the message reports the declaration location first and then only the instantiation location. >> I guess the problem somehow involves generics: > > Yep, there are always problems with generics in GNAT, usually related to > visibility. Use renaming/subtyping of the formal parameters. This might > help to work around bugs. I don't really understand how visibility comes into play here, since declaration, body and instantiation all reside in the same package body. However I admit that compiler writing is arcane enough to lead to unintuitive situation, but such a flat single isolated namespace should be the easiest to deal with. Thanks for your help, Natasha