public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107819] ICE in gfc_check_argument_var_dependency, at fortran/dependency.cc:978 Date: Thu, 24 Nov 2022 19:07:07 +0000 [thread overview] Message-ID: <bug-107819-4-9uHY6dh524@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107819-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107819 --- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> --- (In reply to anlauf from comment #5) > (In reply to Mikael Morin from comment #4) > > But is it required to generate a temporary? > > As I understand it, the code is invalid, and (correctly) diagnosed, so there > > is nothing else to do. > > It's invalid because of 15.5.2.13 Restrictions on entities associated with > > dummy arguments: > > (4) If the value of the entity or any subobject of it is affected through > > the dummy argument, then at any time during the invocation and execution of > > the procedure, either before or after the definition, it shall be referenced > > only through that dummy argument unless (...) > > Right. > > I was confused by two observations. First, NAG & Cray seem to generate > temporaries, while Intel and NVidia don't and would agree with gfortran > after the patch. > > Second, I stumbled over: > > ! 15.5.2.3 Argument association > ! (4) A present dummy argument with the VALUE attribute becomes argument > ! associated with a definable anonymous data object whose initial value is > ! the value of the actual argument. > Ouch! You're right, this makes the part I quoted above irrelevant. And it explicitly asks for a temporary. > So it boils down to what ELEMENTAL actually means in that context. F2018: > > 15.8.3 Elemental subroutine actual arguments > > ! In a reference to an elemental subroutine, if the actual arguments > ! corresponding to INTENT(OUT) and INTENT(INOUT) dummy arguments are > ! arrays, the values of the elements, if any, of the results are the same > ! as would be obtained if the subroutine had been applied separately, in > ! array element order, to corresponding elements of each array actual > ! argument. > > So I read this that > > call s (a(n), a) > > is to be interpreted as > > do i = 1, size (a) > call s (a(n(i)), a(i)) > end do > > and this would actually be well-defined behavior... ;-) With your quote from 15.5.2.3 above, it would be more like: do i = 1, size(a) tmp(i) = a(n(i)) end do do i = 1, size(a) call s(tmp(i), a(i)) end do
next prev parent reply other threads:[~2022-11-24 19:07 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-22 17:41 [Bug fortran/107819] New: " gscfq@t-online.de 2022-11-22 17:42 ` [Bug fortran/107819] " gscfq@t-online.de 2022-11-22 19:41 ` anlauf at gcc dot gnu.org 2022-11-22 21:01 ` anlauf at gcc dot gnu.org 2022-11-24 13:12 ` mikael at gcc dot gnu.org 2022-11-24 17:07 ` anlauf at gcc dot gnu.org 2022-11-24 19:07 ` mikael at gcc dot gnu.org [this message] 2022-11-24 21:24 ` anlauf at gcc dot gnu.org 2022-11-24 21:40 ` mikael at gcc dot gnu.org 2022-11-24 22:02 ` mikael at gcc dot gnu.org 2022-11-25 22:06 ` anlauf at gcc dot gnu.org 2022-11-26 20:56 ` anlauf at gcc dot gnu.org 2022-11-26 21:05 ` mikael at gcc dot gnu.org 2022-11-27 20:33 ` anlauf at gcc dot gnu.org 2022-11-28 18:54 ` cvs-commit at gcc dot gnu.org 2022-11-28 21:27 ` anlauf at gcc dot gnu.org 2022-11-28 21:57 ` pinskia 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-107819-4-9uHY6dh524@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: linkBe 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).