Problems with intrinsic assignments of a derived type to an unlimited polymorphic
Damian Rouson
damian@sourceryinstitute.org
Tue Nov 12 04:12:00 GMT 2019
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
More information about the Fortran
mailing list