strange valgrind error?!

Tobias Burnus burnus@net-b.de
Sat Oct 23 08:35:00 GMT 2010


Daniel Franke wrote:
> While experimenting, I came across a rather strange valgrind error.
> With this code (which I believe to be valid, but read on):
>    REAL, POINTER :: x(:)
>    x =>  NULL()
>    CALL foo(x, 0)
> CONTAINS
>    SUBROUTINE foo(x, n)
>      INTEGER n
>      REAL x(n)

I believe the program is invalid. Passing a NULL pointer is only allowed 
if the dummy is either a POINTER or (since Fortran 2008/gfortran 4.6) 
OPTIONAL (to denote an absent argument).

"12.5.2.3 Argument association
Except in references to intrinsic inquiry functions, a pointer actual 
argument that corresponds to a nonoptional nonpointer dummy argument 
shall be pointer associated with a target."

Tobias



More information about the Fortran mailing list