This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR20779 and PR20891 - allocation of STAT or specification variables in same call
On Mon, Sep 18, 2006 at 08:12:35PM -0500, Erik Schnetter wrote:
> On Sep 18, 2006, at 17:16:59, Paul Thomas wrote:
>
> >With or without the patch in place, gfortran (ifort) compile
> >
> > integer, allocatable :: x(:)
> > integer :: i, j(2)
> > allocate (x(kind(i)), stat=i)
> > print *, size(x)
> > allocate (x(size(j)), stat=j(1))
> > print *, size(x)
> > end
> >
> >to give
> >
> > 4
> > 2
> >
> >as they should. ie. size(i) and kind(j) are just perfectly ordinary
> >expressions. The patch was concerned to catch the non-standard
> >case where STAT or a variable in the specification of other
> >allocated arrays was being allocated in the same statement.
>
> Paul,
>
> I think I meant the expression
>
> allocate (i(1), stat = j(kind(i)))
>
> I got the problem case backwards. (Not that anybody would write code
> like that.) I was wondering whether the code that looks for
> "variable occurs in expression" handles expressions which do not
> depend on the value of a variable, and which are therefore allowed.
> (Or are they?)
>
I know this is going to sound real crazy, but one can take
patches posted to list, apply to the source code, build
gfortran, and test the result.
program p
integer j(8)
integer, allocatable :: i(:)
allocate(i(1), stat=j(kind(i)))
print *, j(4)
end program p
gfc4x -o z p.f90
./z
0
--
Steve