For non-array calls, the "if" is directly created in
trans-intrinsic.c's gfc_conv_associated.

As one can see below, gfortran currently only checks whether two pointers are
the same, it also should check whether they are NULL pointers.

Example:
integer, pointer :: a
nullify(a)
if(associated(a,a)) call abort()
end

and dump:
  int4 * a;
  _gfortran_set_std (70, 127, 0);
  a = 0B;
  if (a == a)
    {
      _gfortran_abort ();
    }


-- 
           Summary: associated(null-pointer, null-pointer) returns .true.
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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

Reply via email to