http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58620
Bug ID: 58620 Summary: [OOP] Defined assignment not called for TYPE when the type's extension is used Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Follow up to PR58469 The code below prints "42" as the defined assignment "assign0" isn't called for "foo". If one uses "type(component)" instead of "type(comp0)" for "foo", one gets the expected output: "20". See also https://groups.google.com/forum/#!topic/comp.lang.fortran/6cW1K0Zj1gU pgf95 and ifort ICEs for the code; using crayftn one gets the same result as with gfortran - namely "20". module m0 implicit none type :: component integer :: i = 42 contains procedure :: assign0 generic :: assignment(=) => assign0 end type type, extends(component) :: comp2 real :: aa end type comp2 type parent type(comp2) :: foo end type contains elemental subroutine assign0(lhs,rhs) class(component), intent(INout) :: lhs class(component), intent(in) :: rhs lhs%i = 20 end subroutine end module program main use m0 implicit none type(parent), allocatable :: left type(parent) :: right left = right print *, left%foo if (left%foo%i /= 20) call abort() end