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.237.53.56 with SMTP id a53mr13248944qte.0.1498835004611; Fri, 30 Jun 2017 08:03:24 -0700 (PDT) X-Received: by 10.36.160.9 with SMTP id o9mr334092ite.9.1498835004365; Fri, 30 Jun 2017 08:03:24 -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!news.glorb.com!v31no1625981qtb.0!news-out.google.com!s132ni2705itb.0!nntp.google.com!188no321970itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 30 Jun 2017 08:03:24 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.6.20.197; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 24.6.20.197 References: <88752790-dedc-4185-aba9-b70361e59d19@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: bug compiler ? From: Anh Vo Injection-Date: Fri, 30 Jun 2017 15:03:24 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:47232 Date: 2017-06-30T08:03:24-07:00 List-Id: On Friday, June 30, 2017 at 7:49:12 AM UTC-7, Anh Vo wrote: > On Friday, June 30, 2017 at 4:09:31 AM UTC-7, Lucretia wrote: > > 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 m= y_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 longe= r 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 de= fine it in a package. You're essentially trying to create a pointer on the = stack to something else on the stack. There is a way around it, I think unc= hecked_conversion, not sure now. > >=20 >=20 > The compiler should reject it if it does not compile with syntax rule. In= this case, it does compile. In fact, if the function expression is replace= d by normal function, it compiles fine.=20 >=20 > Therefore, a bug report should be sent to gnat@adacore.com. >=20 > Anh Vo Correcting my typo - "it does compile" was meant "it does comply"