From: Harald Anlauf <anlauf@gmx.de>
To: Mikael Morin <morin-mikael@orange.fr>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: Aw: Re: [PATCH, v2] Fortran: reject procedures and procedure pointers as IO element [PR107074]
Date: Thu, 6 Oct 2022 23:07:35 +0200 [thread overview]
Message-ID: <trinity-1885e616-30ac-4a8c-8427-a8b7030646d6-1665090455849@3c-app-gmx-bs37> (raw)
In-Reply-To: <6202ba07-98de-b5b4-63bb-4a9a5d76b3b4@orange.fr>
Hi Mikael,
I definitely agree that we need a temporary for the result of
MERGE(a,a,.true.), I just haven't found out how to do that.
The reason for the bad one-liner was that in gfc_simplify_merge
result = gfc_get_parentheses (result);
actually does have issues, in that the subsequent
gfc_simplify_expr (result, 1);
seems to fail in interesting cases (as in PR105371).
So that is something to look into...
Cheers,
Harald
> Gesendet: Donnerstag, 06. Oktober 2022 um 22:32 Uhr
> Von: "Mikael Morin" <morin-mikael@orange.fr>
> An: "Harald Anlauf" <anlauf@gmx.de>
> Cc: "gcc-patches" <gcc-patches@gcc.gnu.org>, "fortran" <fortran@gcc.gnu.org>
> Betreff: Re: [PATCH, v2] Fortran: reject procedures and procedure pointers as IO element [PR107074]
>
> Le 06/10/2022 à 10:37, Mikael Morin a écrit :
> > Le 05/10/2022 à 22:40, Harald Anlauf a écrit :
> >> Hi Mikael,
> >>
> >>> Gesendet: Mittwoch, 05. Oktober 2022 um 12:34 Uhr
> >>> Von: "Mikael Morin" <morin-mikael@orange.fr>
> >>> Please move the check to resolve_transfer in resolve.cc.
> >>
> >> I have done this, see attached updated patch.
> >>
> >> Regtests cleanly on x86_64-pc-linux-gnu.
> >>
> >>> Strangely, the patch doesn't seem to fix the problem on the testcase
> >>> here. There is an outer parenthese expression preventing the condition
> >>> you added from triggering. Can you double check?
> >>
> >> You are right: I had a one-liner in my worktree from PR105371 that
> >> fixes an issue with gfc_simplify_merge and that seems to help here.
> >> It is now included.
> >>
> > The rest looks good, but I'm not sure about your one-liner.
> > I will try to come with a real test later, but in principle, if you have
> > a call to FOO(MERGE(A,A,.TRUE.)) you can't simplify it to FOO(A) as
> > writes to the argument in FOO should not overwrite the content of A. The
> > dummy should be associated with a temporary value, not to A.
> >
> Here is a test that your patch breaks.
> Admittedly it's rejected if A has the INTENT(INOUT) attribute, but
> without it, I think it's allowed.
>
> program p
> integer :: b
> b = 1
> call foo(merge(b,b,.true.))
> if (b /= 1) stop 1
> contains
> subroutine foo(a)
> integer :: a
> if (a == 1) a = 42
> end subroutine foo
> end program p
>
>
prev parent reply other threads:[~2022-10-06 21:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-04 19:27 [PATCH] Fortran: reject procedures and procedure pointers as output item [PR107074] Harald Anlauf
2022-10-05 10:34 ` Mikael Morin
2022-10-05 20:40 ` [PATCH, v2] Fortran: reject procedures and procedure pointers as IO element [PR107074] Harald Anlauf
2022-10-06 8:37 ` Mikael Morin
2022-10-06 20:32 ` Mikael Morin
2022-10-06 21:07 ` Harald Anlauf [this message]
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=trinity-1885e616-30ac-4a8c-8427-a8b7030646d6-1665090455849@3c-app-gmx-bs37 \
--to=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=morin-mikael@orange.fr \
/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).