public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-47023-4-3kexkgyR9u@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47023-4@http.gcc.gnu.org/bugzilla/>

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.


  parent reply	other threads:[~2011-10-17 19:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20  8:59 [Bug fortran/47023] New: " burnus at gcc dot gnu.org
2010-12-22 10:28 ` [Bug fortran/47023] " burnus at gcc dot gnu.org
2011-09-20 11:47 ` florian.rathgeber at gmail dot com
2011-09-20 15:36 ` [Bug fortran/47023] [4.6/4.7 regression] " kargl at gcc dot gnu.org
2011-09-20 15:40 ` kargl at gcc dot gnu.org
2011-09-20 16:49 ` dominiq at lps dot ens.fr
2011-09-29 13:12 ` burnus at gcc dot gnu.org
2011-09-29 13:20 ` rguenth at gcc dot gnu.org
2011-09-29 13:21 ` burnus at gcc dot gnu.org
2011-09-29 13:29 ` janus at gcc dot gnu.org
2011-09-29 15:52 ` burnus at gcc dot gnu.org
2011-10-16  8:44 ` janus at gcc dot gnu.org
2011-10-16 19:43 ` janus at gcc dot gnu.org
2011-10-17  9:47 ` janus at gcc dot gnu.org
2011-10-17 16:00 ` janus at gcc dot gnu.org
2011-10-17 16:16 ` [Bug fortran/47023] " janus at gcc dot gnu.org
2011-10-17 19:11 ` janus at gcc dot gnu.org [this message]
2011-10-17 19:23 ` janus at gcc dot gnu.org
2011-10-18 10:48 ` janus at gcc dot gnu.org
2011-10-18 11:07 ` janus at gcc dot gnu.org
2011-10-18 12:04 ` janus at gcc dot gnu.org
2011-10-18 12:18 ` janus at gcc dot gnu.org
2011-10-18 12:20 ` janus at gcc dot gnu.org
2011-10-18 12:48 ` burnus at gcc dot gnu.org
2011-10-18 13:46 ` janus at gcc dot gnu.org
2011-10-19 22:08 ` janus at gcc dot gnu.org
2011-10-19 22:10 ` janus at gcc dot gnu.org
2013-03-25 15:53 ` burnus at gcc dot gnu.org
2013-03-25 17:46 ` burnus at gcc dot gnu.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=bug-47023-4-3kexkgyR9u@http.gcc.gnu.org/bugzilla/ \
    --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).