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

             Bug #: 50570
           Summary: Incorrect error for assignment to intent(in) pointer
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: lo...@cray.com


> cat test.f90
program bots_sparselu_pointer_intent_in
! derived from Fortran trans of BOTS sparselu

  implicit none
  integer, pointer :: array(:)

  allocate(array(4))
  array = 0
  call sub(array)
  write (*,*) SUM(array)

contains

  subroutine sub(dummy)
     integer, pointer, intent(in) :: dummy(:)
     dummy(1) = 1 ! note that gfortran 4.6.1 accepts "dummy = 1"
  end subroutine sub

end program bots_sparselu_pointer_intent_in

> gfortran -c test.f90
test.f90:16.5:

     dummy(1) = 1 ! note that gfortran 4.6.1 accepts "dummy = 1"
     1
Error: Dummy argument 'dummy' with INTENT(IN) in variable definition context
(assignment) at (1)



This should compile.  In the case of a POINTER dummy, the INTENT(IN) applies to
the pointer association status, not definition of the target.

Appears to be a regression, as 4.5.3 was OK.

Reply via email to