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

--- Comment #28 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Created attachment 33158 [details]
> Reduced test case, 140 lines

Further reduced to

program main
  implicit none

  type :: string_t
     character(LEN=1), dimension(:), allocatable :: chars
  end type string_t

  type(string_t) :: prt_in
  integer :: i
  prt_in = string_t(["W"])
  do i = 1, 16
     print *, i
     call process_configuration (new_prt_spec ([prt_in]))
  end do

contains

  elemental function new_prt_spec (name) result (prt_spec)
    type(string_t), intent(in) :: name
    type(string_t) :: prt_spec
  end function new_prt_spec

  subroutine process_configuration (prt_in)
    type(string_t), dimension(:), intent(in) :: prt_in
  end subroutine process_configuration

end program main

and it does not require iso_varying_string!-)

With 4.9.0 it counts up to 16, while with 4.9.1 and 4.10 with/without the patch
in comment 23 it gives

           1
           2
a.out(71763,0x7fff7bc1d310) malloc: *** error for object 0x7fe788e00000:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
...

Reply via email to