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/38065] private/public confusion with a contained function
Date: Tue, 11 Nov 2008 14:30:00 -0000	[thread overview]
Message-ID: <20081111142849.25426.qmail@sourceware.org> (raw)
In-Reply-To: <bug-38065-15125@http.gcc.gnu.org/bugzilla/>



------- Comment #9 from burnus at gcc dot gnu dot org  2008-11-11 14:28 -------
(In reply to comment #6)
> reduced:
>
>   SUBROUTINE S1
>   CONTAINS
>    TYPE(T1) FUNCTION F1()
>    END FUNCTION F1
>   END SUBROUTINE S1

Error: PUBLIC function 'f1' at (1) cannot be of PRIVATE type 't1'

gfortran has two bugs:
a) F1 is an internal function and thus PUBLIC/PRIVATE does not apply
b) If one makes F1 a (PUBLIC) *module* function, the program still would be a
valid Fortran 2003 program (and an invalid Fortran 95 program).

I still need to test whether the original program is fixed or not; there are
quite a lot files ... 

Fix:
+++ gcc/fortran/resolve.c       (Arbeitskopie)
@@ -10181,0 +10182 @@ resolve_fntype (gfc_namespace *ns)
+      && !sym->attr.contained
@@ -10186,2 +10187,3 @@ resolve_fntype (gfc_namespace *ns)
-      gfc_error ("PUBLIC function '%s' at %L cannot be of PRIVATE type '%s'",
-                sym->name, &sym->declared_at, sym->ts.derived->name);
+      gfc_notify_std (GFC_STD_F2003, "Fortran 2003: PUBLIC function '%s' at "
+                     "%L of PRIVATE type '%s'", sym->name,
+                     &sym->declared_at, sym->ts.derived->name);


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


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


  parent reply	other threads:[~2008-11-11 14:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
2008-11-09 14:58 ` [Bug fortran/38065] bug5 clerman at fuse dot net
2008-11-09 17:23 ` jv244 at cam dot ac dot uk
2008-11-09 21:55 ` clerman at fuse dot net
2008-11-11 13:29 ` [Bug fortran/38065] private/public confusion with a contained function jv244 at cam dot ac dot uk
2008-11-11 13:47 ` clerman at fuse dot net
2008-11-11 14:16 ` jv244 at cam dot ac dot uk
2008-11-11 14:30 ` burnus at gcc dot gnu dot org [this message]
2008-11-11 14:36 ` burnus at gcc dot gnu dot org
2008-11-11 14:37 ` clerman at fuse dot net
2008-11-12  7:02 ` burnus at gcc dot gnu dot org
2008-11-12  7:04 ` burnus at gcc dot gnu dot org
2008-11-12 18:41 ` 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=20081111142849.25426.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).