Hi,

the following code fails to compile unless the two marked lines are 
interchanged:

subroutine gfcbug27 (x)
  real, intent(inout) :: x(:)

  real          :: tmp(size (x,1))  ! gfc produces an error unless
  target        :: x                ! these 2 lines interchanged
  real, pointer :: p(:)

  p => x(:)
end subroutine gfcbug27


I get:

 In file gfcbug27.f90:5

  target        :: x                ! these 2 lines interchanged
                   1
Error: Cannot change attributes of symbol at (1) after it has been used
 In file gfcbug27.f90:8

  p => x(:)
      1
Error: Pointer assignment target is neither TARGET nor POINTER at (1)

Cheers,
-ha

-- 
           Summary: gfortran: TARGET attribute for dummy argument and
                    declaration order
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at hep dot tu-darmstadt dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to