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.171.72 with SMTP id g8mr13404728qaz.7.1376076503717; Fri, 09 Aug 2013 12:28:23 -0700 (PDT) X-Received: by 10.50.107.10 with SMTP id gy10mr293609igb.7.1376076503655; Fri, 09 Aug 2013 12:28:23 -0700 (PDT) Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.fsmpi.rwth-aachen.de!usenet.blueworldhosting.com!feeder02.blueworldhosting.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!fx3no1822105qab.0!news-out.google.com!he10ni1155qab.0!nntp.google.com!fx3no1822104qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 9 Aug 2013 12:28:23 -0700 (PDT) In-Reply-To: <1656c260-4488-42d8-8d31-0fde538470ee@googlegroups.com> 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> <1656c260-4488-42d8-8d31-0fde538470ee@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: GNAT GPL 2013 bug? From: Adam Beneschan Injection-Date: Fri, 09 Aug 2013 19:28:23 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3887 X-Original-Bytes: 4183 Xref: number.nntp.dca.giganews.com comp.lang.ada:182895 Date: 2013-08-09T12:28:23-07:00 List-Id: On Friday, August 9, 2013 11:39:19 AM UTC-7, Adam Beneschan wrote: > > 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; > > 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 tim= e > Offhand, I do think GNAT is wrong, and that P is not a dispatching proced= ure. However, the language rules get a bit murky at times when untagged pr= ivate types are completed with tagged types, and sometimes the rules have h= ad to be changed because they didn't cover this case adequately. I'll have= to dig a bit further. OK, it turns out GNAT is right; AI95-183 says that P is dispatching. I don= 't particularly like that, since it seems to make the behavior, from the ca= ller's point of view, dependent on what's in the private part that the call= er isn't supposed to have to know about. It was probably OK, though, if th= e only effect was that a call to P might actually call some other P in some= other package. However, now that the "not null" rules on anonymous access= parameters have changed, I think this *is* a problem, since now you can't = tell whether a null value is allowed for the access parameter without peeki= ng into the private part. (I think AI95-183 was answered before the "not n= ull" feature was proposed.) So there seems to be a privacy breakage here. A possible solution: Add a rule that if an untagged private type has a full= definition that is tagged, then in any primitive operations declared in th= e visible part with controlling access parameters, the access parameters mu= st be declared with *explicit* null exclusions. This means that the exampl= e suggested by Dmitry and Simon would be caught early--the package specific= ation would be disallowed. This wouldn't be backward-compatible. I'm gues= sing that in practice, this might require modifications to approximately ze= ro code. =20 -- Adam