(j3.2006) procedure declaration and elementals
Van Snyder
Van.Snyder
Fri Mar 13 18:15:52 EDT 2009
On Fri, 2009-03-13 at 11:44 -0700, Bill Long wrote:
> I got this test case:
>
> program f2003_procptr_1
> implicit none
> real :: pi = 3.14159265
> intrinsic :: sin, cos
>
> procedure(sin), pointer :: p => NULL ()
>
> p => sin
> print *, "sin(0), sin(pi/2) =", p(0.0), p(pi/2)
>
> p => cos
> print *, "cos(0), cos(pi) =", p(0.0), p(pi)
>
> end program f2003_procptr_1
>
>
>
> The procedure declaration statement appears to violate C1219
> (09-007:[291:26-27]). What is the rationale for this constraint? Is
> the code nonconforming?
C732 prohibits a <proc-target> to be a nonintrinsic elemental procedure.
7.2.2.4p3 says "<proc-target> may be an elemental intrinsic procedure
even if <proc-pointer-object> is not elemental.
Notwithstanding 7.2.2.4p3, it appears, however, that C1219 prohibits
elemental procedure pointers and elemental dummy procedures. I think
instead of "shall specify an external procedure" it should have been
"C1219 (R1215) If <proc-interface> describes an elemental procedure,
<proc-entity-name> shall not be a <dummy-arg-name>." There is nothing
similar, however, concerning interface bodies, i.e., nothing like
C1205a (R1205) An <interface-body> for a dummy procedure shall not
describe an elemental procedure interface."
While researching this, I came upon 12.5.2.9p5, which ends "...may be
associated with a dummy procedure (which is prohibited from being
elemental)."
I couldn't find where dummy procedures are prohibited from being
elemental (I looked at every occurrence of "elemental" in 09-007). I'm
confident we had something explicit at some time. I also looked through
04-007 and couldn't find it. If it actually has escaped, we need
something like
"C1255a (R1230) A <dummy-argument-name> shall not be the name of an
elemental dummy procedure."
which would be better than saying it twice, in C1205a and C1219.
> Cheers,
> Bill
More information about the J3
mailing list