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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |janus at gcc dot gnu.org

--- Comment #2 from janus at gcc dot gnu.org ---
Here is a reduced test case:


program test

   implicit none

   type :: Otype
      integer, allocatable :: og
   end type

   type(Otype), dimension(:), allocatable :: outarr

   allocate( outarr, source = get_result() )

contains

   function get_result( ) result( outarr )
      class(Otype), dimension(:), allocatable :: outarr
      type(Otype), dimension(1:1) :: oa
      allocate( oa(1)%og )
      allocate( outarr, source = oa )
   end function

end


I see this segfault reliably with gfortran 8 and trunk. Versions 6 and 7 do not
show segfaults on my system, but I still see invalid reads with valgrind, so I
think they are affected as well.

I'll note to the OP that the time in which a fix can be found correlates with
the quality of the bug report. Reduction is something than can certainly done
by the user.

Reply via email to