From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [PATCH] deferred-shape vs assumed-shape
Date: Wed, 1 Apr 2020 13:04:43 -0700 [thread overview]
Message-ID: <20200401200443.GA55208@troutmask.apl.washington.edu> (raw)
See
https://stackoverflow.com/questions/60972134/whats-wrong-with-the-following-fortran-code-gfortran-dtio-dummy-argument-at
Is A(:) a deferred-shape array or an assumed-shape array? The
answer of course depends on context.
This patch fixes the issue found at the above URL.
Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c (revision 280157)
+++ gcc/fortran/interface.c (working copy)
@@ -4916,10 +4916,15 @@ check_dtio_arg_TKR_intent (gfc_symbol *fsym, bool type
|| ((type != BT_CLASS) && fsym->attr.dimension)))
gfc_error ("DTIO dummy argument at %L must be a scalar",
&fsym->declared_at);
- else if (rank == 1
- && (fsym->as == NULL || fsym->as->type != AS_ASSUMED_SHAPE))
- gfc_error ("DTIO dummy argument at %L must be an "
- "ASSUMED SHAPE ARRAY", &fsym->declared_at);
+ else if (rank == 1)
+ {
+ if (fsym->as == NULL
+ || !(fsym->as->type == AS_ASSUMED_SHAPE
+ || (fsym->as->type == AS_DEFERRED && fsym->attr.dummy
+ && !fsym->attr.allocatable && !fsym->attr.pointer)))
+ gfc_error ("DTIO dummy argument at %L must be an "
+ "ASSUMED-SHAPE ARRAY", &fsym->declared_at);
+ }
if (type == BT_CHARACTER && fsym->ts.u.cl->length != NULL)
gfc_error ("DTIO character argument at %L must have assumed length",
--
Steve
next reply other threads:[~2020-04-01 20:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 20:04 Steve Kargl [this message]
2020-04-02 9:34 ` [Patch][Fortran] Resolve formal args before checking DTIO (was: Re: [PATCH] deferred-shape vs assumed-shape) Tobias Burnus
2020-04-02 15:05 ` Steve Kargl
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=20200401200443.GA55208@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@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).