------- Comment #2 from jv244 at cam dot ac dot uk  2010-08-19 09:22 -------
(In reply to comment #1)
> module ptrmod
> contains
> subroutine lengthX(x, i)
>    implicit none
>    real, pointer, intent(out) :: x(:)=>null()

you can't initialize a dummy argument, since initialization implies save. Just
put 'NULLIFY(x)' in the body of the subroutine. Intents for pointers is fine,
but not Fortran95 (2003/2008?)

>    integer :: i
>    allocate(x(i))
>    x=i
> end subroutine
> end module
> 
> program main
>   use ptrmod
>   implicit none
>   real, pointer :: x(:)
>   integer :: i
>   do i=1,5
>      call lengthX(x, i)
>      print *, size(x), x
>   enddo
>   if(associated(x)) deallocate(x)
>   x=>null()
> end program
> 


-- 

jv244 at cam dot ac dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45337

Reply via email to