https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69090
Bug ID: 69090 Summary: Allocatable arrays mishandled in 'omp declare target' Product: gcc Version: unknown Status: UNCONFIRMED Keywords: openmp Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: amonakov at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- Compiling and running the following testcase with non-shared-memory accelerator segfaults in the target region, because only pointed-to data of the allocatable array is copied, but not the array structure (.data, .offset fields) itself. >From my reading of the OpenMP spec, allocatable arrays are not explicitely allowed in the 'declare target' directive, so the code is ill-formed. However, no diagnostic is issued, and generally I don't know what GCC intends to do here. (notably, this test works fine without the 'declare target' directive) DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:), SAVE :: arr !$omp declare target(arr) ALLOCATE(arr(16384)) !$omp target arr(2) = 1 !$omp end target END PROGRAM