From: Mikael Morin <morin-mikael@orange.fr>
To: Harald Anlauf <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fortran: reject procedures and procedure pointers as output item [PR107074]
Date: Wed, 5 Oct 2022 12:34:03 +0200 [thread overview]
Message-ID: <3ff755f3-d514-f7cc-f79c-c554b60c2b83@orange.fr> (raw)
In-Reply-To: <trinity-6d934a50-8304-4704-bce4-36a2afbc687e-1664911631690@3c-app-gmx-bs14>
Hello
Le 04/10/2022 à 21:27, Harald Anlauf via Fortran a écrit :
> Dear all,
>
> when looking at output item lists we didn't catch procedures
> and procedure pointers and ran into a gfc_internal_error().
> Such items are not allowed by the Fortran standard, e.g. for
> procedure pointers there is
>
> C1233 (R1217) An expression that is an output-item shall not
> have a value that is a procedure pointer.
>
> Attached patch generates an error instead.
>
> Regtested on x86_64-pc-linux-gnu. OK for mainline?
>
Please move the check to resolve_transfer in resolve.cc.
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?
If we take the standard to the letter, only output items are forbidden,
so a check is missing for writing context. I don't know how it can work
for input items though, so maybe not worth it. In any case, the error
shouldn't mention output items in reading context.
Here is a variant of the testcase with procedure pointer components,
that fails differently but can probably be caught as well.
program p
implicit none
type :: t
procedure(f), pointer, nopass :: b
end type t
type(t) :: a
interface
real function f()
end function f
end interface
print *, merge (a%b, a%b, .true.)
end
next prev parent reply other threads:[~2022-10-05 10:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-04 19:27 Harald Anlauf
2022-10-05 10:34 ` Mikael Morin [this message]
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 ` 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=3ff755f3-d514-f7cc-f79c-c554b60c2b83@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).