This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran, F08] PR 85537: Invalid memory reference at runtime when calling subroutine through procedure pointer
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Janus Weil <janus at gcc dot gnu dot org>
- Cc: Thomas Koenig <tkoenig at netcologne dot de>, gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 27 Mar 2019 15:28:00 -0700
- Subject: Re: [Patch, Fortran, F08] PR 85537: Invalid memory reference at runtime when calling subroutine through procedure pointer
- References: <CAKwh3qgMxH74fKko6gQd3Y79iAdctWWmTdWYRws6K2=u1eXcPQ@mail.gmail.com> <aa925359-e6a7-0de1-a804-32b7e153eb2b@netcologne.de> <CAKwh3qj-74JeVxz7vN5JFTmTTWjJwcDiVb=ty=oPGuyvi3vuNQ@mail.gmail.com>
- Reply-to: sgk at troutmask dot apl dot washington dot edu
On Wed, Mar 27, 2019 at 11:22:49PM +0100, Janus Weil wrote:
>
> > > the attached patch implements some missing constraints from Fortran
> > > 2008 concerning procedure pointer initialization (cf. the standard
> > > quote in comment #18), thus fixing two accepts-invalid and
> > > ICE-on-invalid problems.
> >
> > I do not think this is correct.
> >
> > F2008:
> >
> > # 12.2.2.4 Procedure pointers
> >
> > # A procedure pointer is a procedure that has the EXTERNAL and POINTER
> > # attributes; it may be pointer associated with an external procedure, #
> > # an internal procedure, [...]
> >
> > So a procedure pointer can be associated with an internal procedure.
> >
> > Comment#18 from the PR does not quote anything that says that
> > a procedure pointer cannot be associated with an internal procedure.
>
> Absolutely, a procedure pointer can in principle be associated with an
> internal procedure, and my patch does not change that. What the patch
> rejects is the ('static' in the C sense) pointer initialization of a
> procedure pointer with an internal procedure, which is forbidden per
> F2008:C1220.
>
> procedure(..), pointer :: pp => internal_proc
>
> A normal pointer assignment is still allowed per F2008:C729:
>
> pp => internal_proc
>
> Hope you agree (and sorry for not being more verbose in my explanation
> in the first place).
>
Just to add to the confusion/clarification. Janus's patch
is concerned with an initial-proc-target, which is has restriction
that do not apply to a proc-target.
--
Steve