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.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.36.101.12 with SMTP id u12mr328606itb.30.1519864025740; Wed, 28 Feb 2018 16:27:05 -0800 (PST) X-Received: by 10.157.11.165 with SMTP id 34mr630086oth.7.1519864025538; Wed, 28 Feb 2018 16:27:05 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!feed.usenet.farm!feeder3.feed.usenet.farm!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!w142no902902ita.0!news-out.google.com!a2ni2495ite.0!nntp.google.com!w142no902897ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 28 Feb 2018 16:27:05 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.245.163.78; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.245.163.78 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <39fc7bbf-77e8-4342-9af7-68cb5e9acb8a@googlegroups.com> Subject: CONSTRAINT ERROR? access check failed From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Thu, 01 Mar 2018 00:27:05 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:50729 Date: 2018-02-28T16:27:05-08:00 List-Id: I got raised CONSTRAINT_ERROR : ledit.adb:34 access check failed for the "while" line before. I found an old post about this problem, alloca= ted composite object being constrained even when being of an unconstrained = subtype... but I hardly understood anything. It's clearly out of my league,= and it's not like I don't LOVE to dig and learn, believe me: procedure INSERT_OR_REPLACE (NUMBER : in LINE_NUMBER; LINE : in STRING) is TEMP : access LINK :=3D HEAD; begin while TEMP.NEXT /=3D null and TEMP.NEXT.NUM < NUMBER loop TEMP :=3D TEMP.NEXT; end loop; TEMP.next :=3D new LINK' (Num =3D> NUMBER, Length =3D> LINE'Length, NEXT =3D> (if TEMP.NEXT.NUM =3D NUMBER then TEMP.NEXT.NEXT else TEMP.= NEXT), Line =3D> LINE); end; So, if someone could provide me a quick solution that don't change much my = current code (I already have trouble understanding it, changing the data st= ructure would crush me)... Here's the LINK type and HEAD constant: type Link (Num : LINE_NUMBER :=3D 0; Length : NATURAL :=3D 0) is record NEXT : access LINK :=3D null; Line : String (1 .. Length) :=3D (1..Length =3D> ' '); end record; HEAD : constant access Link :=3D new LINK '(0,0,null,""); Instead of a snippet, you could advise me to put assertions here and there = to help me see the solution by myself, eventually. But I definitely won't e= at the whole damn allocator AARM section... Mehdi