Hi,

the following *legal Fortran 95* code is falsely rejected
by gfortran.  Note that this differs from PR 29624 which
specifies a F2003 feature for pointers.

% cat gfcbug52.f90
program gfcbug52
  implicit none

  type t
     integer, pointer :: p(:) => NULL ()
  end type t

  type(t) :: a

  allocate (a%p(1))
  call set (a)
  print *, a%p(1)

contains

  subroutine set (b)
    type(t), intent(in) :: b
    if (associated (b%p)) b%p(1) = 1
  end subroutine set

end program gfcbug52
% gfc gfcbug52.f90
gfcbug52.f90:18.27:

    if (associated (b%p)) b%p(1) = 1
                          1
Error: Can't assign to INTENT(IN) variable 'b' at (1)


-- 
           Summary: False error on INTENT(IN) when modifying pointees
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to