I get the following error with the last version of the fortran pgi compiler:
pgf90 tr.f90
PGF90-S-0134-Illegal attribute - conflict with allocatable (tr.f90: 18)
PGF90/x86-64 Linux 7.2-5: compilation completed with severe errors
where tr.f90 is:
program tr
integer, allocatable :: a(:), b(:),c(:)
allocate(a(10))
a = (/ (i,i=1,10) /)
call foo(a,b,c)
write(*,*) b
write(*,*) c
contains
subroutine foo(a,b,c)
implicit none
integer, allocatable, intent(inout) :: a(:)
integer, allocatable, intent(out) :: b(:)
integer, optional, allocatable, intent(out) :: c(:)
allocate(b(size(a)))
if (present(c)) allocate(c(size(a)))
end subroutine foo
end program tr
The code is correctly compiled by other compiler like intel, gnu and xlf.
Is a bug in the pgi compiler or these fortran 2003 features are not still supported?
Thanks.