From: bbaborum@gmail.com
Subject: Re: bug compiler ?
Date: Sun, 2 Jul 2017 09:42:17 -0700 (PDT)
Date: 2017-07-02T09:42:17-07:00 [thread overview]
Message-ID: <2f46ca0e-6197-4a22-afdc-4a39f78b1087@googlegroups.com> (raw)
In-Reply-To: <b347ed13-79e5-4df1-b687-e280ce3459f4@googlegroups.com>
Le vendredi 30 juin 2017 13:09:31 UTC+2, Lucretia a écrit :
> 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.
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.
next prev parent reply other threads:[~2017-07-02 16:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-30 8:49 bug compiler ? bbaborum
2017-06-30 11:09 ` Lucretia
2017-06-30 14:49 ` Anh Vo
2017-06-30 15:03 ` Anh Vo
2017-06-30 18:47 ` Simon Wright
2017-06-30 19:42 ` Anh Vo
2017-07-02 16:43 ` bbaborum
2017-07-02 16:42 ` bbaborum [this message]
2017-06-30 15:11 ` AdaMagica
2017-06-30 18:20 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox