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/41603] [-fwhole-file] Add diagnostic for assumed-length character function
Date: Tue, 06 Oct 2009 14:57:00 -0000	[thread overview]
Message-ID: <20091006145701.5818.qmail@sourceware.org> (raw)
In-Reply-To: <bug-41603-13404@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from burnus at gcc dot gnu dot org  2009-10-06 14:57 -------
See also PR 41604.

I actually cannot find the spot in the standard which renders this example as
invalid. Reading the following excerpt, I have even the feeling that it is
valid:


"A char-length type parameter value of * has the following meaning: [...]

(4) If used to specify the character length parameter of a function result, any
scoping unit invoking the function shall declare the function name with a
character length parameter value other than * or access such a definition by
host or use association. When the function is invoked, the length of the result
variable in the function is assumed from the value of this type parameter."
(F2003, 4.4.4.1 Character type specifier)


As NAG f95 does not diagnose the problem in PR 41604 and ifort (-warn all)
talks about "interface" although there is no interface, the diagnostics might
be bogus.

 * * *

Richard Maine wrote in the thread at comp.lang.fortran:

"If a call was legal before, it is still legal with an explicit interface
(almost always*). [...]
The exceptions are arcane, mostly involving some obscure things that
are basically incompatible with having an explicit interface. The only
one I can think of at the moment is assumed-length character function
results"

The question is only whether an explicit interface is not allowed (as the
compiler error implies) or that the explicit interface may not use a "*"

 * * *

Maybe one could argue the following for disallowing the interfaces:

a) "12.2.2 Characteristics of function results": "If the length of a character
function result is assumed, this is a characteristic."

b) "An interface body specifies all of the characteristics of the explicit
specific interface or abstract interface."

c) "If an explicit specific interface is specified by an interface body or a
procedure declaration statement (12.3.2.3) for an external procedure, the
characteristics shall be consistent with those specified in the procedure
definition, except that the interface may specify a procedure that is not pure
if the procedure is defined to be pure."


If the latter is the correct reading then one needs to have an implicit
interface with a character length (which is not "*, cf. PR 41604), but using an
explicit interface is not allowed.


-- 


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


  parent reply	other threads:[~2009-10-06 14:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06 14:26 [Bug fortran/41603] New: " burnus at gcc dot gnu dot org
2009-10-06 14:27 ` [Bug fortran/41603] " burnus at gcc dot gnu dot org
2009-10-06 14:57 ` burnus at gcc dot gnu dot org [this message]
2009-10-06 15:01 ` burnus at gcc dot gnu dot org
2009-10-06 17:56 ` burnus at gcc dot gnu dot org
2009-10-07  8:02 ` burnus at gcc dot gnu dot org
2009-10-14 16:10 ` burnus at gcc dot gnu dot org
     [not found] <bug-41603-4@http.gcc.gnu.org/bugzilla/>
2011-03-13 15:54 ` pault 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=20091006145701.5818.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).