http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58099

--- Comment #26 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to janus from comment #25)
> The relevant quote for the above error message is F08:12.4.2.2, which says:

Good pointer, though I am not sure whether it is relevant.

Another one is "12.4.3.6 Procedure declaration statement" which is relevant for
the interface declaration part of the proc-pointer.

 * * *

With some digging I found 09-166 - but according to the m188 notes no further
action is done.

And a bit less fitting but with passed J3/WG5, one has: 09-171r1, which got
revised as 09-217 and passed the ballot as Interpretation Request F03-0130.
See: http://j3-fortran.org/doc/year/09/09-217.txt and
http://j3-fortran.org/doc/year/10/10-006T5r1.txt.

>From F03-0130:

Q: "When one of these procedures [i.e. the specific intrinsic procedures listed
in 13.6 and not marked with a bullet] is associated with a dummy procedure or
procedure pointer, does it still have the elemental property?"

A: "The specific intrinsic procedure itself retains the elemental property (so
a reference using its own name can be elemental), but the dummy procedure or
procedure pointer associated with it is not elemental and so cannot be used to
reference the specific intrinsic procedure elementally."

 * * *

As far as I can see, it seems to be valid to have:
  intrinsic :: sin
  procedure(real), pointer :: pp1 => sin
  procedure(sin), pointer :: pp2 => sin ! valid per C1216

  interface
    pure function sin_like(x)
      real, intent(in) :: x
    end function sin_like
  end interface
  procedure(sin_like), pointer :: pp3 => sin

But in all cases, the proc-pointer is not elemental. It doesn't seem to be
valid to have:

  interface
    pure ELEMENTAL function sin_like(x)
      real, intent(in) :: x
    end function sin_like
  end interface
  procedure(sin_like), pointer :: pp4 => sin

But is is valid to have a non-proc-pointer PROCEDURE statement like:
  procedure(sin_like) :: external_sin_like_function

For the latter two, the following applies:
"C1218 (R1211) If a proc-interface describes an elemental procedure, each
procedure-entity-name shall specify an external procedure."

[Side note: We should also check that dummy arguments are correctly handled.]

Reply via email to