[J3] ac-implied-do + const-expr — question on expansion of such arrays

Tobias Burnus burnus at net-b.de
Wed Oct 14 16:53:22 EDT 2020


the following issue came up – and it was unclear whether
"kind=i" is a "constant expression" or not when used as

In terms of compilers, one accepts it and two reject it.

If one first checks the expression itself, then "i" is
an ac-do-variable not not really constant for kind=i,
not fulfilling the constraint for kind=; while the int(i)
part is fine for 'int' (not constant but also not required).
If after this checking, the array is expanded, everything
else becomes known and simplifies to an array of numbers.

However, if the array is first expanded and then the values
are checked for constness, kind=n1 and kind=n2 are fine.

What's the proper interpretation?

use iso_fortran_env
integer, parameter :: n1 = minval(integer_kinds)
integer, parameter :: n2 = maxval(integer_kinds)
integer, parameter :: A(*) = [integer :: (int(A=i, kind=i), i=n1,n2,n2-n1)]
print *, A


More information about the J3 mailing list