For an array section that is not a subobject of a structure component, the rank is the number of subscript triplets and vector subscripts in the section_subscript_list. The number of elements in the shape array is the same as the number of subscript triplets and vector subscripts, and each element in the shape array is the number of integer values in the sequence designated by the corresponding subscript triplet or vector subscript.
DIMENSION :: ARR1(10,20,100)
TYPE STRUCT2_T
LOGICAL SCALAR_COMPONENT
END TYPE
TYPE STRUCT_T
TYPE (STRUCT2_T), DIMENSION(10,20,100) :: SECTION
END TYPE
TYPE (STRUCT_T) STRUCT
! One triplet + one vector subscript, rank = 2.
! Triplet designates an extent of 10, vector subscript designates
! an extent of 3, thus shape = (/ 10,3 /).
ARR1(:, (/ 1,3,4 /), 10) = 0
! One triplet, rank = 1.
! Triplet designates 5 values, thus shape = (/ 5 /).
STRUCT%SECTION(1,10,1:5)%SCALAR_COMPONENT = .TRUE.
! Here SECTION is the part of the component that is an array,
! so rank = 3 and shape = (/ 10,20,100 /), the same as SECTION.
STRUCT%SECTION%SCALAR_COMPONENT = .TRUE.