About EQUIVALENCE in F90

From: Arman Khalatyan (arm2arm_at_thsun1.jinr.ru)
Date: 05/19/04


Date: 19 May 2004 11:29:13 -0700

Hello!
I have in my F77 code:
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

       integer lspecies(10)
       real extras(100)
       EQUIVALENCE (lspecies(1),extras(11))

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
How to organize such a thing with F90 pointers.
I tried :
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
 real , target ::extras(:)
 integer, pointer:: lspecies(:)
subroutine AllocateMemory
 allocate(extras(100))
 lspecies=>extras(11:21)
end subroutine AllocateMemory
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
But ifc compiler and pgf90 compilers returning errors:
_________________________________________________
pgf90:Illegal POINTER assignment - type mismatch
ifc:This pointer and the target must have the same type, type parameters and rank
_________________________________________________

Please help me.

Cheers Arman.



Relevant Pages

  • Re: association with zero-length array?
    ... Requirements for pointer and target association ... POINTER attribute, TARGET attribute, pointer association ... If PTR has the POINTER attribute and TGT has the TARGET or ... and TGT considered to be pointer associated, i.e., under which of the ...
    (comp.lang.fortran)
  • Re: TARGET and INTENT(IN)
    ... you can use a pointer to point at something and then modify it through the pointer. ... A pointer is very much like a dummy argument. ... With this meaning of "TARGET" for INTENTdummys I don't see the point - the compiler still doesn't do anything different than for INTENTdummys without TARGET. ... I've been known to have wrapper routines that try to make life simpler for both the routines that calls them and the lower-level routines that they call. ...
    (comp.lang.fortran)
  • Re: Pointers in structure constructors
    ... the actual argument will be an appropriate target, ... It is the compiler's tolerance for inappropriate use of my provided "structure constructor" that is bothering me. ... dummy argument, the actual argument may not be a null pointer. ...
    (comp.lang.fortran)
  • Re: Rules for valid pointer deallocation
    ... forrtl: severe: A pointer passed to DEALLOCATE points to an array ... the allocated array is 10 and the extent of the target ... dummy array is also 10, because n is 10 in this ...
    (comp.lang.fortran)
  • Recursive Algorithm again
    ... the target is to traverse a field of 3 x 3 where it is started at ... There is indicated the pointer 3. ... RECURSIVE SUBROUTINE next_node ... ENDDO ...
    (comp.lang.fortran)