Consider the following snippet:

implicit none
integer, pointer :: p
print *,associated(p)
end

This is actually invalid and should probably trigger a runtime error. Section
13.7.13 of the Fortran 2003 standard says that the pointer argument of
ASSOCIATED should not be undefined, which it is in the case above (cf. section
16.4.2).

Also see the discussion in http://gcc.gnu.org/ml/fortran/2006-06/msg00235.html
and follow-ups.

Right now the above program simply prints "T". This is kind of dangerous, since
it looks like the pointer is associated with some target, while in fact it is
not. ifort prints "F". I didn't check other compilers.


-- 
           Summary: ASSOCIATED & undefined pointers
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39230

Reply via email to