(j3.2006) (SC22WG5.4166) Please say this isn't allowed!

Reinhold Bader Reinhold.Bader
Sun Feb 7 15:38:37 EST 2010


Hello,

referring to the 2003 standard, I think this is illegal due to 12.4.1.2 
(p270,  20-22).:
"If the dummy argument has the TARGET attribute and the corresponding 
actual argument does not
have the TARGET attribute or is an array section with a vector 
subscript, any pointers associated with
the dummy argument become undefined when execution of the procedure 
completes."

Regards
Reinhold

N.M. Maclaren schrieb:
> While writing a paper on C interoperability, I was checking on Fortran's
> equivalents to some C facilities, and I cannot find anything that forbids
> this.  NAG objects to it, but Intel and Pathscale allow it - or, at 
> least,
> let it happen ....
>
> PROGRAM Main
>    REAL, POINTER, DIMENSION(:) :: p => NULL()
>    REAL :: x = 1.0, y = 2.0, z = 3.0
>    CALL Fred ( (/ x,y,z /) )
>    PRINT *, p
> CONTAINS
>    SUBROUTINE Fred (arg)
>        REAL, TARGET, DIMENSION(:) :: arg
>        p => arg
>    END SUBROUTINE Fred
> END PROGRAM Main
>
> Regards,
> Nick Maclaren.
>




More information about the J3 mailing list