From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17747 invoked by alias); 4 Oct 2013 16:34:12 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 17702 invoked by uid 48); 4 Oct 2013 16:34:09 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/58620] New: [OOP] Defined assignment not called for TYPE when the type's extension is used Date: Fri, 04 Oct 2013 16:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg00232.txt.bz2 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