[Bug fortran/58099] [4.8/4.9 Regression] [F03] over-zealous procedure-pointer error checking
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 3 23:03:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58099
--- Comment #27 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #26)
> 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."
Thus, the following code is invalid:
interface
elemental real function x(y) ! Valid external procedure
real, intent(in) :: y
end function x
end interface
! pointer :: x ! < comment aside: this proc-ptr would violate C1218
intrinsic :: sin
call foo(sin)
contains
subroutine foo(z)
procedure(x) :: z ! INVALID per C1218
! procedure(sin) :: z ! Valid - but not elemental ...
print *, z([1.,2.,3.]) ! ... hence this invalid too for "procedure(sin)::z"
end subroutine foo
end
See also:
"12.5.2.9 Actual arguments associated with dummy procedure entities
[...]
If the interface of a dummy procedure is explicit, its characteristics as a
procedure (12.3.1) shall be the same as those of its effective argument, except
that a pure effective argument may be associated with a dummy argument
that is not pure and an elemental intrinsic actual procedure may be associated
with a dummy procedure (which cannot be elemental)."
[The parenthesis is a consequence of C1218, see comment 26 for the quote.]
Thus:
* I think we need a check for elemental as dummy argument and reject it
* For the patch (comment 18), I wonder whether whether one should leave out the
"elemental" assignment and just do the "pure" assignment.
More information about the Gcc-bugs
mailing list