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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.172.68 with SMTP id k4mr13176971qaz.1.1376073560187; Fri, 09 Aug 2013 11:39:20 -0700 (PDT) X-Received: by 10.50.83.6 with SMTP id m6mr419899igy.1.1376073560138; Fri, 09 Aug 2013 11:39:20 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!f7no1732499qan.0!news-out.google.com!he10ni1155qab.0!nntp.google.com!fx3no1817914qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 9 Aug 2013 11:39:19 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=RxNzCgoAAACA5KmgtFQuaU-WaH7rjnAO NNTP-Posting-Host: 66.126.103.122 References: <19fr4wmxmen$.gjbias2fj461$.dlg@40tude.net> <72539e4c-dddd-40e4-82e8-14c4f2016ccc@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1656c260-4488-42d8-8d31-0fde538470ee@googlegroups.com> Subject: Re: GNAT GPL 2013 bug? From: Adam Beneschan Injection-Date: Fri, 09 Aug 2013 18:39:20 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 3712 Xref: number.nntp.dca.giganews.com comp.lang.ada:182889 Date: 2013-08-09T11:39:19-07:00 List-Id: On Friday, August 9, 2013 11:25:57 AM UTC-7, Simon Wright wrote: >=20 > > On Friday, August 9, 2013 9:11:35 AM UTC-7, Simon Wright wrote: >=20 > >> > In some of the examples in your later post (like the one where Q is > >> > private and the full type is a tagged record), there isn't a problem > >> > either, since the procedure isn't dispatching. >=20 > >> So when GNAT says, at the procedure call, that a null value isn't > >> allowed and that CE will be raised, it's wrong? >=20 > > I just tried it on a case with "type Q is private" [not tagged] and a > > full definition "type Q is tagged null record", and I didn't get a > > warning. In the example you posted, GNAT is correct to display a > > warning, but your procedure *is* dispatching, and this situation isn't > > the same as the part of my post that you quoted. >=20 > I was talking about a slightly different case, corresponding to yours I > think: >=20 > package Dmitry is > type Q is private; > procedure P (X : access Q) is null; > private > type Q is tagged null record; > end Dmitry; >=20 > with Dmitry; use Dmitry; > procedure Test_Dmitry is > Y : access Q; > begin > P (Y); ------ dmitry.ada:11 > end Test_Dmitry; >=20 > and get (GCC 4.8.1 and GNAT GPL 2013): >=20 > gnatmake test_dmitry.adb -gnat12 -f > gcc -c -gnat12 test_dmitry.adb > dmitry.ada:9:04: warning: variable "Y" is read but never assigned > dmitry.ada:11:07: warning: null value not allowed here > dmitry.ada:11:07: warning: "Constraint_Error" will be raised at run time > gcc -c -gnat12 dmitry.ads > gnatbind -x test_dmitry.ali > gnatlink test_dmitry.ali OK, that's essentially the same Ada code I was testing. However, I was usi= ng an older version of GNAT when I tried it and didn't get a warning. Late= r versions do give a warning. =20 Offhand, I do think GNAT is wrong, and that P is not a dispatching procedur= e. However, the language rules get a bit murky at times when untagged priv= ate types are completed with tagged types, and sometimes the rules have had= to be changed because they didn't cover this case adequately. I'll have t= o dig a bit further. -- Adam