[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gnat bug, but which version?

Nicolas Boulenguez wrote:
the following source (originating in opentoken-6.0a-1) is
- rejected by gcc-4.9,
- accepted by GNAT-GPL-2014 and GNAT-Pro-7.3.1.
Is it valid Ada 2012?

package P is
    A : access constant Integer;
    procedure P (I : aliased in Integer);
end P;
package body P is
    procedure P (I : aliased in Integer) is
       A := I'Access;  --  non-local pointer cannot point to local object
    end P;
end P;
Well.  I'm pretty sure it isn't valid Ada 95.

If P was a function, 3.10.2(13.3/3) would come into play:

13.3/3The accessibility level of an explicitly aliased (see 6.1 <cid:part2.00030103.03020209@jacob-sparre.dk>) formal parameter in a function body is determined by the point of call; it is the same level that the return object ultimately will have.

As far as I can see 3.10.2 contains nothing about accessibility levels of explicitly formal parameters in procedure (and entry) bodies - except that it isn't (necessarily) the "same accessibility level as the master representing the invocation of the entity".

I think we've found a bug in the LRM.


"I've got _plenty_ of common sense!"
"I just choose to ignore it."

Reply to: