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!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: CONSTRAINT ERROR: erroneous memory access Date: Sun, 7 Jun 2020 10:51:44 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 7 Jun 2020 08:51:45 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="b243c502e7d88efa94d0bed85751046f"; logging-data="16332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ldWgLRJThyr/ygg0rDHMCjXa8tWaNjnk=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cancel-Lock: sha1:Y/+nkSTMnIXaNoBlOK8HVvtV23A= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58995 Date: 2020-06-07T10:51:44+02:00 List-Id: On 6/7/20 1:40 AM, jcupak@gmail.com wrote: > It has been a few years since I have written Ada; I used and taught Ada 95 back when I was working for a defense contractor. But, now that I'm retired, I wanted to get up to speed with Ada 2012, so I decided to implement a main program to see how the Shortest_Paths generic package works (taken from A.18.31, pages 574-576). But, when I read in the data and call the Shortest_Path function, it returns with CONSTRAINT ERROR: erroneous memory access. I've tried multiple times, but can't seem to figure out what I'm doing (or NOT doing) wrong. Actually ARM A.18.32: http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-A-18-32.html Since you're using Ada 12, you must be using GNAT. With its default options, GNAT is not an Ada compiler. You need to add -gnatan -fstack-check to obtain full Ada semantics. (Technically, you also need -gnatE, but that doesn't affect the behavior of a properly elaborated program.) With those options, I suspect you'll get Storage_Error, which might be easier to understand. -- Jeff Carter "How'd you like to hide the egg and gurgitate a few saucers of mocha java?" Never Give a Sucker an Even Break 101