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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-11-15
                 CC|                            |janus at gcc dot gnu.org
      Known to work|                            |5.4.1, 6.2.0
            Summary|segfault allocating         |[7 Regression] [OOP]
                   |polymorphic variable with   |segfault allocating
                   |polymorphic component with  |polymorphic variable with
                   |allocatable component       |polymorphic component with
                   |                            |allocatable component
     Ever confirmed|0                           |1

--- Comment #1 from janus at gcc dot gnu.org ---
I can confirm that the code runs fine with 6.2 and 5.4, but segfaults with
trunk.

Slightly reduced test case:

program p
  implicit none
  type ac
  end type
  type, extends(ac) :: a
     integer, allocatable :: b
  end type
  type n
     class(ac), allocatable :: acr(:)
  end type
  type(n) :: s,t
  allocate(a :: s%acr(1))
  call nncp(s,t)
contains
  subroutine nncp(self,tg)
    type(n) :: self, tg
    allocate(tg%acr(1),source=self%acr(1))
  end
end

Reply via email to