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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-01-11
                 CC|                            |pault at gcc dot gnu.org
             Blocks|                            |68241
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The following reduced (and invalid!-) code

module stringModule
   implicit none

   type :: string
      character(len=:), allocatable :: raw
   contains
      procedure :: DoWork
   end type

contains

   subroutine DoWork(self, others)
      class(string), intent(in) :: self
      class(string), intent(in) :: others(:)
      integer :: i
      print *, size(others)
      do i = 1, size(others)
         write (*,*) "'", others(i-1)%raw, "'"
      enddo
   end subroutine

end module

subroutine leak
   use stringModule
   implicit none
   type(string) :: s

   s = string('just some string')
   call s%DoWork([string('a string'),string('another longer string')])
end subroutine

program bug
   call leak
end program

gives

           2
 'a string'
 'another longer string'

at run time with gcc-5, 6 and trunk (7.0). Compiling the tests with gcc-4.9
gives

pr79053_db.f90:29.7:

   s = string('just some string')
       1
Error: No initializer for component '_raw_length' given in the structure
constructor at (1)!
pr79053_db.f90:30.18:

   call s%DoWork([string('a string'),string('another longer string')])
                  1
Error: No initializer for component '_raw_length' given in the structure
constructor at (1)!
pr79053_db.f90:30.37:

   call s%DoWork([string('a string'),string('another longer string')])
                                     1
Error: No initializer for component '_raw_length' given in the structure
constructor at (1)!

Related to pr72709.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68241
[Bug 68241] [meta-bug] [F03] Deferred-length character

Reply via email to