From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16705 invoked by alias); 17 Oct 2011 19:11:01 -0000 Received: (qmail 16694 invoked by uid 22791); 17 Oct 2011 19:10:59 -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, 17 Oct 2011 19:10:46 +0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47023] C_Sizeof: Rejects valid code Date: Mon, 17 Oct 2011 19:11: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-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-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 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-10/txt/msg01704.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47023 --- Comment #15 from janus at gcc dot gnu.org 2011-10-17 19:10:44 UTC --- The following should fix comment #1: Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 180078) +++ gcc/fortran/decl.c (working copy) @@ -1000,20 +1000,24 @@ verify_c_interop_param (gfc_symbol *sym) { if (sym->ns->proc_name->attr.is_bind_c == 1) { - is_c_interop = - (verify_c_interop (&(sym->ts)) - == SUCCESS ? 1 : 0); + is_c_interop = (verify_c_interop (&(sym->ts)) == SUCCESS ? 1 : 0); if (is_c_interop != 1) { /* Make personalized messages to give better feedback. */ if (sym->ts.type == BT_DERIVED) - gfc_error ("Type '%s' at %L is a parameter to the BIND(C) " - "procedure '%s' but is not C interoperable " + gfc_error ("Variable '%s' at %L is a dummy argument to the " + "BIND(C) procedure '%s' but is not C interoperable " "because derived type '%s' is not C interoperable", sym->name, &(sym->declared_at), sym->ns->proc_name->name, sym->ts.u.derived->name); + else if (sym->ts.type == BT_CLASS) + gfc_error ("Variable '%s' at %L is a dummy argument to the " + "BIND(C) procedure '%s' but is not C interoperable " + "because it is polymorphic", + sym->name, &(sym->declared_at), + sym->ns->proc_name->name); else gfc_warning ("Variable '%s' at %L is a parameter to the " "BIND(C) procedure '%s' but may not be C " @@ -3716,6 +3720,8 @@ verify_c_interop (gfc_typespec *ts) if (ts->type == BT_DERIVED && ts->u.derived != NULL) return (ts->u.derived->ts.is_c_interop || ts->u.derived->attr.is_bind_c) ? SUCCESS : FAILURE; + else if (ts->type == BT_CLASS) + return FAILURE; else if (ts->is_c_interop != 1) return FAILURE; It also fixes the wording of the error message for derived types, which uses the terms 'type' and 'parameter' in a wrong way.