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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Warning: accessibility check failure with GNAT GPL 2013 Date: Mon, 28 Oct 2013 16:49:28 +0100 Organization: cbb software GmbH Message-ID: References: <4395468b-93d3-45f4-8bc0-91cd646ff1d9@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: IenaDxMXK2hi7fvYcb+MlQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:17550 Date: 2013-10-28T16:49:28+01:00 List-Id: On Mon, 28 Oct 2013 08:23:40 -0700 (PDT), sangomarco@gmail.com wrote: > Thanks for your quick response. I don't have enough experience with Ada, > please could you tell me more about the rule? I don't understand why this > is not allow. It is allowed, unfortunately. That is why you have got only warning, not an error. Unfortunately, because it does not make sense in 90% of cases in practice. > My goal is to create a main task which makes a successor > tasks if necessarry. And, since I cannot use the sybtype mak to create a > new task in the current execution of a main task body as the following > declaration Use a named access type instead. E.g. type Cyclic_Thread_Ptr is access all Cyclic_Thread: Informally, "new" adapts to the expected access type. So does the anonymous access type from its side. When both meet each other there is no information available to determine the scope where the allocated object would live. The language rules use the most conservative estimation of that scope (the body of the subprogram), which in practice never corresponds to the programmer's intent. The resulting accessibility check necessarily fails at run time. Be glad you were warned by the compiler. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de