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.31.7.131 with SMTP id 125mr3887643vkh.23.1498820970309; Fri, 30 Jun 2017 04:09:30 -0700 (PDT) X-Received: by 10.36.67.202 with SMTP id s193mr547830itb.9.1498820970269; Fri, 30 Jun 2017 04:09:30 -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!m54no1571168qtb.1!news-out.google.com!k7ni4226itk.0!nntp.google.com!v202no210683itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 30 Jun 2017 04:09:29 -0700 (PDT) In-Reply-To: <88752790-dedc-4185-aba9-b70361e59d19@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5; posting-account=L2-UcQkAAAAfd_BqbeNHs3XeM0jTXloS NNTP-Posting-Host: 2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5 References: <88752790-dedc-4185-aba9-b70361e59d19@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: bug compiler ? From: Lucretia Injection-Date: Fri, 30 Jun 2017 11:09:30 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:47221 Date: 2017-06-30T04:09:29-07:00 List-Id: On Friday, 30 June 2017 09:49:59 UTC+1, bbab...@gmail.com wrote: > Hello everyone, > > I tried to compile this > > 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 :=f'access; > begin > null; > end bug; > > with the command line : gcc -c -gnat2012 bug.adb > > and then I get this message from the compiler: > > > raised STORAGE_ERROR : stack overflow or erroneous memory access > > If I modify the type "my_int" by writing subtype my_int is integer; > then I dont get any error from the compiler. > > More interesting, if in the first program, the function f is no longer written inline, then I dont get any error. > > Does anyone know what's happeing ? You can't create a local pointer to f or anything there, you have to define 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 unchecked_conversion, not sure now. Luke.