Xavier Lapillonne wrote:
> Hi,
>
> I would like to check that some pointers have been correctly associated with allocated arrays.
>
> In the following example:
> PROGRAM test
> IMPLICIT NONE
> INTEGER, ALLOCATABLE, TARGET :: a(:)
> INTEGER, POINTER :: pa(:)
>
> pa=>a !a is not allocated
This statement does not conform to the standard. It says (7.2.2.4, last
sentence of para 2) "If the pointer target is allocatable, it shall be
allocated."
> PRINT*, ASSOCIATED(pa)
> END PROGRAM test
>
> is it garantee that "ASSOCIATED(pa)" will retrun False when "a" is not allocated ?
The legalistic answer is that your program does not conform to the
standard, so the compiler is allowed to do anything. In practice, I
expect it to return false.
Hope this helps,
John Reid.
|