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!feeder.eternal-september.org!aioe.org!.POSTED.shJgfmHC9bH51L/Ba4rfRQ.user.gioia.aioe.org!not-for-mail From: russ lyttle Newsgroups: comp.lang.ada Subject: Re: Gnat Problem - Freezing too soon Date: Sun, 3 Mar 2019 15:42:12 -0500 Organization: Aioe.org NNTP Server Message-ID: References: <2c369d78-70ea-4593-af3d-e014b0c1fc00@googlegroups.com> <4081906e-91de-43fa-a816-067f707c6d7d@googlegroups.com> <161c749f-b9db-465f-8ffe-7900d3a4bff5@googlegroups.com> NNTP-Posting-Host: shJgfmHC9bH51L/Ba4rfRQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:55772 Date: 2019-03-03T15:42:12-05:00 List-Id: On 3/2/19 4:35 PM, Simon Wright wrote: > russ lyttle writes: > >> I meant why it solved this particular problem. As far as I can tell, >> the authors never used the "not null" in any of their books. Would >> other compilers accept the code as written, or should the code be >> considered erroneous? > > 'not null' is clearly better style. > > With regard to > > task type Sporadic (S : Any_Sporadic_State; > A : Any_Sporadic_Thread_Interface) > with Priority => S.pri > is > > GNAT CE 2018 fails, GNAT GPL 2017 & earlier & GCC 9 succeed. You can see > that making the type 'not null' would eliminate a check (check would be > done at the call site instead), so that the internal tree generated by > the compiler would be different, and the compiler may have been changed > in this region for other reasons. > > With regard to > > protected type Sporadic_Agent (S: Any_Sporadic_State) > with Priority => S.Ceiling_Prioriy > is > > all the compilers are seriously confused: > > sporadics.ada:30:22: no selector "Ceiling_Prioriy" for type "Sporadic_State'Class" defined at line 17 > sporadics.ada:30:23: possible misspelling of "Ceiling_Priority" > sporadics.ada:30:23: possible misspelling of "Ceiling_Priority" > sporadics.ada:30:23: possible misspelling of "Ceiling_Priority" > > and you only have to look at the task equivalent above to see that it > should have been OK. This one looks like another compiler error to me. > There is a misspelling: Prioriy => Priority. Correct that misspelling and the idiom _sometimes_ works without the "not null". The bug report had an instance of where the compiler failed. Would it be helpful to add an instance where it passed? >> As Simon pointed out replacing "with Priority => S.pri" with "pragma >> Priority(S.pri)" also works. They never used that form either. >> >> Why would the authors prefer one form over the others? > > The aspect is the newer form; the book was published in 2016, so they'd > have gone with that. > That's a good reason :)