"If any statement of the construct references a list item, a new list item of the same type and type parameters is allocated: once for each implicit task in the parallel construct; once for each task generated by a task construct; and once for each SIMD lane used by a SIMD construct. The initial value of the new list item is undefined."
I think it would be useful to make clear that also no default initializer is applied. While one can deduce it from the last sentence, making it clear would help.
Regarding "22.214.171.124 firstprivate clause":
"If the original list item does not have the POINTER attribute, initialization of the new list items occurs as if by intrinsic assignment, unless the original list item has the allocation status of not currently allocated, in which case the new list items will have the same status."
The term "intrinsic assignment" is very unclear and the wording should be corrected. Assume:
- Code: Select all
TYPE(t2) :: a
END TYPE t
TYPE(t) :: x, y
x = y
Here, intrinsic assignment is used for "x = y". However, if for type(t2) a defined assignment exists, Fortran mandates that the defined assignment is used for the assignment of the "a" component (i.e. for "x%a = y%a"). I think OpenMP's wording is unclear - but a strict reading implies that the defined assignment should be used. I believe that was not intended.
I assume the same as with ALLOCATE(..., SOURCE=...) should be done. There, Fortran 2008 simply states: "On successful allocation, if allocate-object and source-expr have the same rank the value of allocate-object becomes that of source-expr, otherwise the value of each element of allocate-object becomes that of source-expr." - That avoids the problems with the intrinsic assignment. Alternatively, it should be made clear that "intrinsic assignment" should also be applied for the components.
For completeness, Fortran 2008 states the following regarding intrinsic assignments ("126.96.36.199 Interpretation of intrinsic assignments"):
An intrinsic assignment where the variable is of derived type is performed as if each component of the variable were assigned from the corresponding component of expr using pointer assignment (7.2.2) for each pointer component, defined assignment for each nonpointer nonallocatable component of a type that has a type-bound defined assignment consistent with the component, intrinsic assignment for each other nonpointer nonallocatable component, and intrinsic assignment for each allocated coarray component. For unallocated coarray components, the corresponding component of the variable shall be unallocated. For a noncoarray allocatable component the following sequence of operations is applied. [...]
(Edited to correct the quote.)