From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: Thomas Koenig <tkoenig@netcologne.de>,
"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, fortran] Fix PR 44960, accepts invalid reference on function
Date: Fri, 17 Jan 2020 16:26:00 -0000 [thread overview]
Message-ID: <20200117144235.GA78187@troutmask.apl.washington.edu> (raw)
In-Reply-To: <d783cfff-a732-b5d4-d0b5-e4a35d85a102@codesourcery.com>
On Fri, Jan 17, 2020 at 09:29:33AM +0100, Tobias Burnus wrote:
> On 1/17/20 4:49 AM, Steve Kargl wrote:
> > On Thu, Jan 16, 2020 at 11:34:43PM +0100, Thomas Koenig wrote:
> >> +type(t) :: foo
> >> +print *, foo(1)%a ! { dg-error "Function call can not contain a reference" }
> > I do not understand this error message, and find it to be confusing.
> > foo(1)%a looks like an invalid array reference. That is, foo is scalar
> > and foo(1) is an array element.
>
> Well, we simply do not know whether "external" or "dimension" has been
> forgotten. As "external" can also be determined by the use, we end up
> regarding it as function referenceâ¦
>
> Another example:
>
> character(len=4):: str
> print *, str(1)(1:4)
> end
>
> Maybe a more helpful error message is: "Unexpected junk after function
> reference or missing dimension declaration for %s", sym->name)
>
> (Or instead of "junk" the fancier variant of my previous email.)
>
Gfortran probably should not try to guess what the user
thought s/he wanted. The generic "Syntax error" would
seem to apply here. To me, foo(1)%a looks much more like
an array reference rather than a function reference.
--
Steve
next prev parent reply other threads:[~2020-01-17 14:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 23:00 Thomas Koenig
2020-01-17 7:03 ` Steve Kargl
2020-01-17 8:43 ` Tobias Burnus
2020-01-17 16:26 ` Steve Kargl [this message]
2020-01-17 23:14 ` Thomas Koenig
2020-01-18 0:06 ` Steve Kargl
2020-01-18 12:09 ` Tobias Burnus
2020-01-18 12:55 ` Thomas Koenig
2020-01-19 1:58 ` Thomas Koenig
2020-01-19 2:17 ` Tobias Burnus
2020-01-17 8:31 ` Tobias Burnus
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=20200117144235.GA78187@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=tkoenig@netcologne.de \
--cc=tobias@codesourcery.com \
/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).