https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831
--- Comment #32 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> --- Dear Dominique, The problem is due to: atmp.10.offset = 0; { integer(kind=8) S.12; S.12 = 0; while (1) { if (S.12 > 0) goto L.4; { struct string_t D.2386; struct string_t D.2385; D.2385 = (*(struct string_t[1] * restrict) atmp.7.data)[S.12]; D.2386 = new_prt_spec (&D.2385); if (D.2385.chars.data != 0B) /* between here */ { __builtin_free ((void *) D.2385.chars.data); } D.2385.chars.data = 0B; /* and here */ (*(struct string_t[1] * restrict) atmp.10.data)[S.12] = D.2386; } S.12 = S.12 + 1; } L.4:; } process_configuration (&atmp.10); if ((struct string_t[1] * restrict) atmp.10.data != 0B) I cannot see yet, where it comes in nor when it was introduced. Paul On 21 July 2014 12:51, dominiq at lps dot ens.fr <gcc-bugzi...@gcc.gnu.org> wrote: > 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. > > -- > You are receiving this mail because: > You are on the CC list for the bug.