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.200.56.250 with SMTP id g55mr18094091qtc.18.1467390493888; Fri, 01 Jul 2016 09:28:13 -0700 (PDT) X-Received: by 10.157.53.22 with SMTP id o22mr884208otc.7.1467390493846; Fri, 01 Jul 2016 09:28:13 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!f89no1247374qtd.0!news-out.google.com!o189ni14004ith.0!nntp.google.com!r1no8495517ige.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 1 Jul 2016 09:28:13 -0700 (PDT) In-Reply-To: <82fe84fe-4ff1-46fa-9bce-737beeb3d102@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=216.121.226.25; posting-account=ENgozAkAAACH-stq5yXctoDQeZQP2E6J NNTP-Posting-Host: 216.121.226.25 References: <66c14298-c62d-4f4b-b0c0-e969454f9334@googlegroups.com> <431af616-7df3-4e4d-9262-26ed68cb74c7@googlegroups.com> <037df2b8-b9c4-4447-87ee-cc89d7072b30@googlegroups.com> <15914c54-191c-4f37-b754-282855d1aeaf@googlegroups.com> <3e25c9a0-469c-4487-b78e-6f87434f87fa@googlegroups.com> <2e69ca6f-484c-4d58-b0fe-d17a744b1418@googlegroups.com> <9ada1cdc-2fbd-4009-99f1-aba71ac1b9d2@googlegroups.com> <2954ae98-c4a0-4089-93bc-97854e009785@googlegroups.com> <581cb97c-9d81-4a81-9a05-eed0516ce287@googlegroups.com> <689e8b26-3ece-4d72-8992-d42b04fab3b4@googlegroups.com> <82fe84fe-4ff1-46fa-9bce-737beeb3d102@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0a7b4865-2aa2-4c50-82e7-350c7401e537@googlegroups.com> Subject: Re: Generic Embedded List Nodes From: Warren Injection-Date: Fri, 01 Jul 2016 16:28:13 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:30995 Date: 2016-07-01T09:28:13-07:00 List-Id: On Friday, 1 July 2016 09:49:19 UTC-4, Warren wrote: > On Saturday, 25 June 2016 01:50:41 UTC-4, Niklas Holsti wrote: > > On 16-06-24 15:49 , Warren wrote: > .. > > procedure Insert_At_Head ( > > List : access List_T; > > Node : in Emb_Node_Ref_T) > > is > > begin > > if List.Next /= null then > > List.Next.Prev := Node; > > end if; > > Node.Next := List.Next; > > List.Next := Node; > > Node.Prev := Emb_Node_Ref_T (List); > > end Insert_At_Head; > > Niklas: I finally got a few minutes to revisit this and worked up a full example based upon yours. I fear that the design is still flawed. I'm using a slightly modified version of this, but basically, the problem occurs at the line: > > > Node.Prev := Emb_Node_Ref_T (List); > > with the exception: > > raised PROGRAM_ERROR : niklas.adb:14 accessibility check failed > > My example code is located on github here: https://github.com/ve3wwg/ada_embedded_list > > Maybe there is pilot error somewhere. I'm using: GNATMAKE 6.1.0. > > Warren Sorry, nevermind. When I allocate the list with: List1: aliased access List_T := new List_T; it is fine. I suppose that the runtime was worried about dangling pointers when it was originally allocated on the stack frame in: List1: aliased List_T; Warren