From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5072 invoked by alias); 25 Jul 2013 12:29:08 -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 4968 invoked by uid 48); 25 Jul 2013 12:29:04 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/57966] [OOP] Using a TBP to specify the shape of a dummy argument Date: Thu, 25 Jul 2013 12:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: janus 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-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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-07/txt/msg01205.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57966 --- Comment #7 from janus at gcc dot gnu.org --- The following patch fixes both variants (comment 1 and comment 5): Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 201238) +++ gcc/fortran/resolve.c (working copy) @@ -5686,7 +5686,9 @@ resolve_compcall (gfc_expr* e, const char **name) } +static bool resolve_fl_derived (gfc_symbol *sym); + /* Resolve a typebound function, or 'method'. First separate all the non-CLASS references by calling resolve_compcall directly. */ @@ -5772,6 +5774,9 @@ resolve_typebound_function (gfc_expr* e) /* Get the CLASS declared type. */ declared = get_declared_from_expr (&class_ref, &new_ref, e, true); + + if (!resolve_fl_derived (declared)) + return false; /* Weed out cases of the ultimate component being a derived type. */ if ((class_ref && class_ref->u.c.component->ts.type == BT_DERIVED) The problem was actually that the TBP was not properly resolved (or more precisely: that the resolution came too late), so that the FUNCTION attribute was not yet set. Regtesting now ...