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

            Bug ID: 59143
           Summary: Problem with array dimension in polymorphic types
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de

The following code produces a warning, but is valid code:

gfortran  -c phs_single.f90
phs_single.f90:14.16:

    call func1 (phs%decay_p ())
                1
Warning: Actual argument contains too few elements for dummy argument 'p' (1/2)
at (1)

The code is:

module phs_single
  type :: phs_single_t
     real, dimension(:), allocatable :: p
   contains
     procedure :: evaluate
     procedure :: decay_p 
  end type phs_single_t

contains

  subroutine evaluate (phs)
    class(phs_single_t), intent(inout) :: phs
    call func1 (phs%decay_p ())
  end subroutine evaluate

  subroutine func1 (p)
    real, dimension(2), intent(in) :: p
    print *, p
  end subroutine func1

  function decay_p (phs) result (p)
    class(phs_single_t), intent(in) :: phs
    real, dimension(2) :: p
    p(1) = 1.
    p(2) = 5.
  end function decay_p

end module phs_single

Reply via email to