Fortran 2023: An array or allocatable object may have a coarray component

We are currently discussing the following new Fortran 2023 feature:

See this quote from Modern Fortran explained, Fortran 2023 edition, chapter 23.6.1, p.455-456:

“…, Fortran 2018 requires that a variable or component that is of a type with a coarray ultimate component be a non-pointer non-allocatable non-coarray scalar. Fortran 2023 permits such a variable or component to be an array and/or allocatable, … This can happen at any depth of component selection,…

I did interpret that this would allow a coding style as shown with the simple test case below:

program main
end program main


module test
implicit none
private

type, public :: a
  private
  integer, public, allocatable, dimension(:), codimension[:] :: coarray
end type a

type, public :: b
  private
  type(a), public, allocatable, dimension(:) :: channels_1 ! compile time error 
  ! with ifx 2025.0.0:
  ! error #8474: A data component whose type has a coarray potential subobject 
  ! component must be a nonpointer nonallocatable scalar.
end type b

type(a), public, allocatable, dimension(:) :: channels_2 ! compiles and runs 
  ! perfectly with ifx 2025.0.0

end module test

But the compiler engineers do validly point to the Fortran 2023 standards text:

C753 A data component whose type has a coarray potential subobject component shall be a nonpointer non-allocatable scalar and shall not be a coarray.

Any idea what is wrong here? Did I mistake Modern Fortran explained? Or is there an error in the Fortran 2023 standard text, or is Modern Fortran explained wrong?

Regards

1 Like

This has been addressed in the paper 25-100 with the number F23/009 titled coarray sub-object of component.

1 Like

Thanks very much for pointing to this. This already solves the issue:

Interestingly, I was already aware of C825 using the word “entity” and thought hopefully this could be for exactly that case.

Regards

1 Like