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

Re: gnat bug, but which version?



* Nicolas Boulenguez:

> Dear collective wisdom,
> 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
>    begin
>       A := I'Access;  --  non-local pointer cannot point to local object
>    end P;
> end P;

This must be rejected to prevent dangling pointers.  I think the Ada
2012 RM rules make the program invalid.


Reply to: