[J3] Is this code valid?
John Reid
john.reid9 at talktalk.net
Tue Apr 29 20:09:21 UTC 2025
Neil,
I think you mean 10.1.11 rather than 10.11.1.
I see the code as valid because:
The list is an "or" list (you have to do down to item (16) to see this).
so only one item needs to be true. Item (4) is true in both cases so we
have a restricted expression and all is well.
Cheers,
John.
Carlson, Neil via J3 wrote:
> In the following example, a subroutine declares two arrays, one within
> a BLOCK and the other within an internal subroutine. The specification
> expressions involve a designator whose base object is a dummy argument
> in the host subroutine with INTENT(OUT).
>
> The NAG compiler accepts both as valid, while Intel and gfortran
> reject both citing 10.11.1 item 2 (essentially). However item 4 would
> seem to apply (making this valid) since the base object is made
> accessible by host association. This seems pretty clear to me in the
> case of the internal subroutine, though much less so in the BLOCK
> case. What do you think?
>
> -Neil
>
> module foo
>
> type :: bar
> integer :: n
> end type
>
> contains
>
> subroutine init(this, n)
> type(bar), intent(out) :: this
> integer, intent(in) :: n
> this%n = n
> block
> real :: array1(this%n)
> end block
> call sub
> contains
> subroutine sub
> real :: array2(this%n)
> end subroutine
> end subroutine
>
> end module
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20250429/903dd86b/attachment.htm>
More information about the J3
mailing list