http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47586
Summary: allocatable components: deep copy missing
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Follow-up to PR 47455 (comment #5):
type :: tx
integer, dimension(:), allocatable :: i
end type tx
type(tx) :: this
type(tx), target :: that
type(tx), pointer :: p
allocate(that%i(2))
that%i = [0, 0]
p => that
! this = that ! (1) direct assignment: works (deep copy)
! this = p ! (2) using a pointer works as well
this = find_x(that) ! (3) pointer function: fails (deep copy missing)
that%i = [1, 1]
print *,this%i
if(any (this%i /= [0, 0])) call abort()
contains
function find_x(that)
type(tx), target :: that
type(tx), pointer :: find_x
find_x => that
end function find_x
end
This code currently fails for the third case, while it works for the first two.