https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68174

            Bug ID: 68174
           Summary: Length parameter in character allocation not
                    recognized as a scalar (regression from 5.2)
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: neil.n.carlson at gmail dot com
  Target Milestone: ---

The following example is rejected by 6.0.0 20151025, but is accepted by 6.0.0
20150906 and 5.2.0.  It is valid Fortran.

% gfortran -c gfortran-bug-20151101A.f90 
gfortran-bug-20151101A.f90:15:25:

       allocate(character(this%maxlen) :: this%mold)
                         1
Error: Scalar INTEGER expression expected at (1)

module example

  type :: foo
    class(*), allocatable :: mold
    integer :: maxlen
  end type

contains

  subroutine pop (this)
    class(foo), intent(inout) :: this
    select type (uptr => this%mold)
    type is (character(*))
      deallocate(this%mold)
      allocate(character(this%maxlen) :: this%mold)
    end select
  end subroutine

end module

Reply via email to