(j3.2006) contraining procedure-designator
malcolm at nag-j.co.jp
malcolm
Thu Jul 26 10:54:00 EDT 2007
> Bob Cprbett showed me a case of a constraint that cannot
> always be checked at compile-time. Given the subroutine
>
> SUBROUTINE SUBR(P)
> EXTERNAL P
> CALL P
> END
>
> the call-stmt
> CALL procedure-designator
> is constrained by C1222 (R1218):
> "The procedure-designator shall designate a subroutine."
> (It's C1227 (R1220) in 07-007r2).
>
> But either this is meaningless (dummy function P can't be distinguished
> from dummy subroutine P)
That is where you are completely wrong. The constraint itself
distinguishes! In the quoted program, ***P IS A SUBROUTINE***.
That is the effect of the constraint when you don't have any
other use of P (obviously, it has diagnostic consequences if
you try to give P a type, use it as a function, etc.).
Thus, passing a function to SUBR, even if the CALL statement is
never executed, is not conforming. But that is not enforced by
contraint - that's an argument mismatch.
> or this constraint needs to be implemented at
> run-time, which might entail breaking binary compatibility with Fortran 95.
> Was that the intention?
No, you are confusing applying the constraint to the dummy, which
is fine, with applying it to the actual. There ain't no actual
in sight here, so of course that doesn't work!
But the constraint does not mention any actual, it mentions the
dummy. There is no problem here.
Cheers,
.....................Malcolm.
More information about the J3
mailing list