Hi,

the following legal code fails to compile with gfortran:

% cat gfcbug50.f90
module gfcbug50
  implicit none
contains

  subroutine foo (n, y)
    integer, intent(in)         :: n
    integer, dimension(bar (n)) :: y
    ! Array bound is specification expression, which is allowed (F2003, sect.
7.
1.6)
  end subroutine foo

  pure function bar (n) result (l)
    integer, intent(in) :: n
    integer             :: l
    l = n
  end function bar

end module gfcbug50
% gfc -c gfcbug50.f90
gfcbug50.f90:7.23:

    integer, dimension(bar (n)) :: y
                      1
Error: Expression at (1) must be of INTEGER type


This is wrong.  bar(n) is a specification expression.
See e.g. the F2003 standard, sect. 7.1.6

Cheers,
-ha


-- 
           Summary: Specification expression not properly recognized in type
                    declaration
           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=30283

Reply via email to