https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123574

            Bug ID: 123574
           Summary: [OpenMP] ALLOCATE clause for array-descriptors should
                    apply to the array data
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
        Depends on: 113436, 119905
  Target Milestone: ---

The following program allocates the array descriptor and not the
array data with the specified alignment / allocator
[2 = omp_large_cap_mem_alloc ].
For code relying on the alignment, this is a wrong-code issue.

--------------------
! use omp_lib
integer, allocatable :: a(:)

!$omp parallel firstprivate(a) allocate(align(128) : a)
  if (allocated(a)) stop 1
!$omp end parallel

!$omp target firstprivate(a) allocate(align(128), allocator(2_8) : a)
  if (allocated(a)) stop 1
!$omp end target

end
--------------------

For non-mapping data-sharing clauses, this likely should be handled via:
  gfc_omp_clause_default_ctor + gfc_omp_clause_copy_ctor

For the TARGET construct (data-mapping clauses), it depends at least
on PR113436 - and it relates to PR119905.

Kudos to Kwok for finding this issue!


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113436
[Bug 113436] [OpenMP] 'allocate' clause has no effect for (first)private on
'target' directives
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119905
[Bug 119905] [OpenMP] Fortran deep mapping of allocatable components: Recursive
types and FIRSTPRIVATE/PRIVATE not handled

Reply via email to