This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strange valgrind error?!


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]