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

            Bug ID: 87151
           Summary: allocating array of character
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: valeryweber at hotmail dot com
  Target Milestone: ---

dear all

gcc 8.2 seems to have a problem allocating the string below. the len() should
be 2, is that a bug?

many thanks

valery


cat alloc_char.f90
module bvec
    type, public :: bvec_t
     private
     character(:), dimension(:), allocatable :: vc     
   contains
     PROCEDURE, PASS :: create
  end type bvec_t
contains
  subroutine create(this)
    class(bvec_t), intent(inout) :: this
    allocate(character(2)::this%vc(3))
    write(*,*) len(this%vc),size(this%vc)
  end subroutine create
end module bvec

program test
  use bvec
  type(bvec_t) :: a
  call a%create()
end program test



gfortran-8.2.0 alloc_char.f90
./a.out 
           0           3

Reply via email to