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

--- Comment #31 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Further reduced test

program main
  implicit none

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

  type(string_t) :: prt_in, tmp(1)
  integer :: i
  prt_in = string_t(["W"])
  do i = 1, 16
     print *, i
     tmp = 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

end program main

> However, nevertheless you would want to understand why the elemental
> function causes a malloc crash for dim 1 arrays and works for scalars
> and dim > 1 arrays as input.

The faulty block is not used for scalars.

Reply via email to