Hello,
I would like to check if a pointer inside a derived type has already been defined or not. I wrote the following simple code to show you my problem:
program test
implicit none
type y
real(8), pointer :: x(:)
end type y
type(y), pointer :: w(:)
allocate(w(2))
allocate(w(1)%x(2))
write(*,*) associated(w(1)%x), associated(w(2)%x)
end program test
Compiling this code with gFortran 4.4.1 and running it on Ubuntu gives the result:
T F
whereas the same code compiled on Windows Vista with the Intel Fortran compiler 11.0 provides:
T T
The first result (gFortran) is what I am actually expecting. But the fact that the Intel compiler provides a different result makes me fear my code might not be correct. Am I doing something terribly wrong with the pointers in this example? Any idea or explanation?
Many thanks in advance for your help!