public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/45211] C interoperable error when compiling BIND(C) function in a module.
Date: Sat, 14 Aug 2010 16:25:00 -0000	[thread overview]
Message-ID: <20100814162459.5235.qmail@sourceware.org> (raw)
In-Reply-To: <bug-45211-16432@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from burnus at gcc dot gnu dot org  2010-08-14 16:24 -------
Cf.
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/887251d8cd64eb02

Lightly tested patch. The ts.is_c_interop is only set when via
verify_bind_c_derived_type, which is called by resolve.c - and thus comes too
late.

I am not sure whether this now allows DT which are not BIND(C) and whether one
thus should add an !attr.resolved, but I assume that incompatibilities between
the BIND(C) attribute for the DT and the actual DT will be found at resolution
time. Thus, the patch should be fine.

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (Revision 163239)
+++ gcc/fortran/decl.c  (Arbeitskopie)
@@ -991,7 +991,7 @@ verify_c_interop_param (gfc_symbol *sym)
              /* 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 "
+                          "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, 
@@ -3612,7 +3612,8 @@ gfc_try
 verify_c_interop (gfc_typespec *ts)
 {
   if (ts->type == BT_DERIVED && ts->u.derived != NULL)
-    return (ts->u.derived->ts.is_c_interop ? SUCCESS : FAILURE);
+    return (ts->u.derived->ts.is_c_interop || ts->u.derived->attr.is_bind_c)
+          ? SUCCESS : FAILURE;
   else if (ts->is_c_interop != 1)
     return FAILURE;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45211


  parent reply	other threads:[~2010-08-14 16:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 17:13 [Bug fortran/45211] New: " brtnfld at hdfgroup dot org
2010-08-06 17:26 ` [Bug fortran/45211] " dominiq at lps dot ens dot fr
2010-08-09 15:03 ` brtnfld at hdfgroup dot org
2010-08-14 16:25 ` burnus at gcc dot gnu dot org [this message]
2010-08-15 16:21 ` burnus at gcc dot gnu dot org
2010-08-15 16:23 ` burnus at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100814162459.5235.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).