Le 04/07/2023 à 01:56, Steve Kargl a écrit :
On Mon, Jul 03, 2023 at 10:49:36PM +0200, Harald Anlauf via Fortran wrote:Indeed, this is a nice demonstration. While playing, I was wondering whether the following code is conforming: program p call s ((1)) contains subroutine s (x) integer :: x x = 42 end subroutine end (It crashes with gfortran, but not with any foreign brand tested).It's not conforming. '(1)' is an expression and it cannot appear in a variable definition condition. I am not aware of any numbered constraint tha would require a Fortran processor to generate an error.
I think you would be right if X had INTENT(OUT) or INTENT(INOUT) attribute. This is F2023, 15.5.2.4 (no mention of variable definition context here):
If a dummy argument has INTENT (OUT) or INTENT (INOUT), the actual argument shall be definable.
However, with unspecified intent, I can't find the rule explicitly forbidding the above example.
I'm tempted to say it is conforming.
