From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10216 invoked by alias); 31 Jan 2011 21:42:44 -0000 Received: (qmail 10200 invoked by uid 22791); 31 Jan 2011 21:42:42 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 31 Jan 2011 21:42:37 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47463] [OOP] ICE in gfc_add_component_ref X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: janus at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 31 Jan 2011 21:53:00 -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 X-SW-Source: 2011-01/txt/msg03452.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47463 --- Comment #9 from Tobias Burnus 2011-01-31 21:42:29 UTC --- (In reply to comment #6) > > And the same without type-binding: > > call init_comps(this, st, gr) > > Error: Type mismatch in argument 'this' at (1); passed CLASS(flow_t) to > > CLASS(grid_t) I looked closer at that version. a) It works if one reverses the order of subroutines (all versions) Rich: That's a work around, which is sufficient to compile the whole program. Note: You need a gfortran, which includes Janus' patch from comment 8. b) For the failing version. The formal argument in compare_actual_formal alias compare_parameter is odd: (gdb) p a->expr->ts.u.derived->name $17 = 0x2aaaacf0eae0 "__class_hydro_flow_Flow_t" (gdb) p f->sym->ts.u.derived->name $18 = 0x2aaaacf0eac0 "__class_hydro_grid_Grid_t_a" (gdb) p f->sym->name $19 = 0x2aaaace40fb0 "this" Namely, the formal argument has the right name, but it is associated with the wrong typespec! * * * Reduced test case: module hydro_grid type :: grid_t contains procedure :: assign generic :: assignment(=) => assign end type grid_t public :: grid_t contains subroutine assign (this, that) class(grid_t), intent(inout) :: this class(grid_t), intent(in) :: that end subroutine assign end module hydro_grid module hydro_flow use hydro_grid type :: flow_t class(grid_t), allocatable :: gr ! Computation grid end type flow_t contains subroutine init_params (this) class(flow_t), intent(out) :: this type(grid_t) :: gr call init_comps(this, gr) end subroutine init_params subroutine init_comps (this, gr) class(flow_t), intent(out) :: this class(grid_t), intent(in) :: gr this%gr = gr end subroutine init_comps end module hydro_flow