public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <morin-mikael@orange.fr>
To: Harald Anlauf <anlauf@gmx.de>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: Re: [PATCH, v2] Fortran: reject procedures and procedure pointers as IO element [PR107074]
Date: Thu, 6 Oct 2022 22:32:18 +0200	[thread overview]
Message-ID: <6202ba07-98de-b5b4-63bb-4a9a5d76b3b4@orange.fr> (raw)
In-Reply-To: <e0c8bdd7-50b3-3895-496e-7dcece680201@orange.fr>

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


  reply	other threads:[~2022-10-06 20:32 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 [this message]
2022-10-06 21:07         ` Aw: " Harald Anlauf

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=6202ba07-98de-b5b4-63bb-4a9a5d76b3b4@orange.fr \
    --to=morin-mikael@orange.fr \
    --cc=anlauf@gmx.de \
    --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).