This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems with intrinsic assignments of a derived type to an unlimited polymorphic


All,

Compiling the program below with a GCC trunk build dated 20190926
produces an executable file that generates a segmentation fault at
runtime due to an invalid memory reference.  Would this be a duplicate
of PR 83118 if submitted?  Interestingly, removing the second
intrinsic assignment leads to an "undefined symbols" linker error.

Damian

  implicit none

  type Wrapper
    class(*), allocatable :: elements(:)
  end type

  class(*), allocatable :: obj
  type(Wrapper) w
  integer :: expected(1)=1

  w = new_wrapper(expected)
  obj = w  ! Runtime eg fault
  obj =  new_wrapper(expected) ! Linker error if above line is removed
contains
  type(Wrapper) function new_wrapper(array)
    class(*) array(:)
    new_wrapper%elements = array
  end function
end


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]