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.2.154 with SMTP id p26mr16552176qtg.59.1499013738246; Sun, 02 Jul 2017 09:42:18 -0700 (PDT) X-Received: by 10.36.23.151 with SMTP id 145mr972851ith.7.1499013738209; Sun, 02 Jul 2017 09:42:18 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!1.eu.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!m54no1944658qtb.1!news-out.google.com!s132ni623itb.0!nntp.google.com!188no692309itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 2 Jul 2017 09:42:17 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.245.93.252; posting-account=Bq5dRQoAAABBHvP12Bu1r05kdpr_XDjE NNTP-Posting-Host: 82.245.93.252 References: <88752790-dedc-4185-aba9-b70361e59d19@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2f46ca0e-6197-4a22-afdc-4a39f78b1087@googlegroups.com> Subject: Re: bug compiler ? From: bbaborum@gmail.com Injection-Date: Sun, 02 Jul 2017 16:42:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:47258 Date: 2017-07-02T09:42:17-07:00 List-Id: Le vendredi 30 juin 2017 13:09:31 UTC+2, Lucretia a =C3=A9crit=C2=A0: > On Friday, 30 June 2017 09:49:59 UTC+1, bbab...@gmail.com wrote: > > Hello everyone, > >=20 > > I tried to compile this=20 > >=20 > > procedure bug is > > type my_int is new integer; > > type access_function_my_int is access function (n : my_int) return my_= int; > > function f (n : my_int) return my_int is (n); > > a : access_function_my_int :=3Df'access; > > begin > > null; > > end bug; > >=20 > > with the command line : gcc -c -gnat2012 bug.adb > >=20 > > and then I get this message from the compiler: > >=20 > >=20 > > raised STORAGE_ERROR : stack overflow or erroneous memory access > >=20 > > If I modify the type "my_int" by writing subtype my_int is integer; > > then I dont get any error from the compiler. > >=20 > > More interesting, if in the first program, the function f is no longer = written inline, then I dont get any error. > >=20 > > Does anyone know what's happeing ? >=20 > You can't create a local pointer to f or anything there, you have to defi= ne it in a package. You're essentially trying to create a pointer on the st= ack to something else on the stack. There is a way around it, I think unche= cked_conversion, not sure now. >=20 > Luke. No. My access function is perfectly legal in this case. If it were a problem, the compiler would produce an error message. Instead = it simply crashes. You didn't read the end of my post.