OffTarget

Observed issues › fuzz/gcc-strided-target-update-rejected

Appears not to supportRefused at compile time · Fortran · OpenMP · Open

A Fortran array section with a stride in a target update motion clause is rejected

Legality: not independently confirmed. no independent review yet How this is checked

Same issue as harvest/gcc-c-strided-section-rejected; this program is another reproducer of it.

OpenMP 5.0 allows array sections that specify discontiguous storage in target update. GCC 16.2 rejects from(a(1:n:2)) ("Array is not contiguous") for both offload targets; its documentation lists discontiguous array sections in target update as not supported.

Affected variants

CompilerMI300A gfx942
unified memory (XNACK 1)
MI300A gfx942
copy (XNACK 0)
MI250X gfx90a
copy (XNACK 0)
MI300X gfx942
copy (XNACK 0)
MI350X gfx950
copy (XNACK 0)
A100 sm_80
separate memory
A100 sm_80
managed memory
AFAR 24.3.0fails another wayfails another wayunknown
not run
fails another wayfails another wayn/an/a
CCE 19.0.0fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
NVHPC 25.11n/an/an/an/an/afails another wayfails another way
NVHPC 26.9n/an/an/an/an/afails another wayfails another way
GCC 16.2.0not supportednot supportednot supportednot supportednot supportednot supportedn/a

"behaves incorrectly" / "not supported": this issue, confirmed in up to four environments (another build directory, another node, a repeat). "fails another way": a different failure, not counted as this issue. "unknown": not run there, or the runs disagree.

Messages

ResultCompiler and GPUMessage
not supportedGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
GCC 16.2.0, MI300X
GCC 16.2.0, MI350X
show
site-fuzz--gcc-strided-target-update-rejected.f90:42:28:
   42 |   !$omp target update from(a(1:n:2))
      |                            1~~~~~~~
Error: Array is not contiguous at (1)
site-fuzz--gcc-strided-target-update-rejected.f90:42:28:
   42 |   !$omp target update from(a(1:n:2))
      |                            1~~~~~~~
Error: Stride should not be specified for array section in FROM clause at (1)
not supportedGCC 16.2.0, MI250X
GCC 16.2.0, A100 separate
show
site-fuzz--gcc-strided-target-update-rejected.f90:35:28:
   35 |   !$omp target update from(a(1:n:2))
      |                            1~~~~~~~
Error: Array is not contiguous at (1)
site-fuzz--gcc-strided-target-update-rejected.f90:35:28:
   35 |   !$omp target update from(a(1:n:2))
      |                            1~~~~~~~
Error: Stride should not be specified for array section in FROM clause at (1)
fails another wayAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
AFAR 24.3.0, MI300X
AFAR 24.3.0, MI350X
show
bad= 8
RESULT ran_on_host=0 check=fail
fails another wayCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
  !$omp target update from(a(1:n:2))
                            ^        
ftn-1747 ftn: ERROR TARGET_UPDATE_STRIDED, File = site-fuzz--gcc-strided-target-update-rejected.f90, Line = 35, Column = 29 
  The stride specified for array "A" must not be greater than 1. Subarray references in the MAP clause must be to contiguous memory.
Cray Fortran : 51 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
fails another wayCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable..
  !$omp target update from(a(1:n:2))
                            ^        
ftn-1747 ftn: ERROR TARGET_UPDATE_STRIDED, File = site-fuzz--gcc-strided-target-update-rejected.f90, Line = 35, Column = 29 
  The stride specified for array "A" must not be greater than 1. Subarray references in the MAP clause must be to contiguous memory.
Cray Fortran : 51 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
fails another wayCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
  !$omp target update from(a(1:n:2))
                            ^        
ftn-1747 ftn: ERROR TARGET_UPDATE_STRIDED, File = site-fuzz--gcc-strided-target-update-rejected.f90, Line = 35, Column = 29 
  The stride specified for array "A" in the MAP clause must not be greater than 1.
Cray Fortran : 51 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-S-0034-Syntax error at or near : (site-fuzz--gcc-strided-target-update-rejected.f90: 35)
  0 inform,   0 warnings,   1 severes, 0 fatal for target_update_strided

Reproduce

GCC 16.2.0, MI300A unified

export LD_LIBRARY_PATH=$GCC_16_2/lib64:/opt/rocm-7.2.1/lib
$GCC_16_2/bin/gfortran -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

GCC 16.2.0, A100 separate

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=$GCC_16_2/lib64
$GCC_16_2/bin/gfortran -fopenmp -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 repro.f90 -o repro
OMP_TARGET_OFFLOAD=mandatory ./repro
Program (51 lines)
! # Finding (GCC 16.2, fuzz sample): a Fortran array section with a stride in a target update motion clause is rejected
!
! - toolchains: gcc_g90 (GCC 16.2.0, AMD Instinct MI250X gfx90a, Tioga) and gcc_sm80 (GCC 16.2.0, NVIDIA A100 sm_80, wingtip);
!   separate memory only; -O2
! - build: gfortran -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx90a -O2 (gcc_g90);
!   -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 (gcc_sm80)
! - failure: rejected: Array is not contiguous
! - observed: `Error: Array is not contiguous at (1)` and `Error: Stride should not be specified for array section in FROM clause at
!   (1)` at the target update directive, on both targets
! - expected: compiles; prints `bad= 0` and `RESULT ran_on_host=0 check=pass` (only the odd elements come back)
! - rule: "The target update construct ... was modified to allow array sections that specify discontiguous storage" (5.2 §B.4 p.634
!   l.3-4, the changes from 4.5 to 5.0); the contiguous-storage restriction is the map clause's (5.2 §5.8.3 p.155 l.10), not the
!   motion clauses'.
! - GCC's documentation: libgomp.texi, OpenMP 5.0 table: "Discontiguous array section with target update construct: N" (not
!   supported, documented). The C form is harvest/gcc-c-strided-section-rejected.c.
! - other families: AFAR, CCE and NVHPC fail this file another way (site matrix; AFAR's own strided-update finding is
!   harvest/afar-flang-strided-target-update.f90). The site's finding matrix runs this file on every compiler.
! - fuzz programs (116 cells (58 gcc_g90, 58 gcc_sm80); gate: confirmed 116; confirmer: needs_human (R12b-compile-undecided) 106,
!   compiler_bug (R11-compile-rejection) 10): s1:1040, s1:1692, s1:1792, s1:2014, s1:2084, s1:2160, s1:2267, s1:2617, s1:2744,
!   s1:2949, s1:2970, s1:3049, s1:3197, s1:3219, s1:3392, s1:3457, s1:3503, s1:3685, s1:4207, s1:4477, s1:4501, s1:4655, s1:4680,
!   s1:4788, s1:5088, s1:5371, s1:5383, s1:547, s1:5522, s1:562, s1:6125, s1:6197, s1:6430, s1:6554, s1:6670, s1:6685, s1:6831,
!   s1:6915, s1:7055, s1:7099, and 18 more (the index entry lists them)
! - legality: two witnesses that are neither GCC nor a compiler this finding is about, offload.engine.rules and AFAR flang's front
!   end, accept this file (offload.engine.prerun.check; results/parity/tioga/results/parity/legality.jsonl) and the fuzz programs
!   (the campaign's legality gate; its base-language check, gfortran -std=f2008 without OpenMP, is a syntax check of the base
!   language only and no witness). GCC is a compiler under test only and never a legality witness.
program target_update_strided
  use omp_lib, only: omp_is_initial_device
  implicit none
  integer, parameter :: n = 16
  integer :: a(n), i, bad, host_flag
  a = -1
  !$omp target enter data map(to: a)
  host_flag = 1
  !$omp target map(tofrom: host_flag)
    host_flag = merge(1, 0, omp_is_initial_device())
    do i = 1, n
      a(i) = i
    end do
  !$omp end target
  ! every second element: a(1), a(3), ..., a(15)
  !$omp target update from(a(1:n:2))
  !$omp target exit data map(delete: a)
  bad = 0
  do i = 1, n
    if (mod(i, 2) == 1 .and. a(i) /= i) bad = bad + 1
    if (mod(i, 2) == 0 .and. a(i) /= -1) bad = bad + 1
  end do
  print '(a,i0)', 'bad= ', bad
  print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', bad == 0)
end program target_update_strided

Source in the repository

Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page

Expected and observed

Expected

check=pass

Observed where it behaves incorrectly

site-fuzz--gcc-strided-target-update-rejected.f90:42:28:
   42 |   !$omp target update from(a(1:n:2))
      |                            1~~~~~~~
Error: Array is not contiguous at (1)
site-fuzz--gcc-strided-target-update-rejected.f90:42:28:
   42 |   !$omp target update from(a(1:n:2))
      |                            1~~~~~~~
Error: Stride should not be specified for array section in FROM clause at (1)

What the specification requires

The specification text this program relies on and the compiler is expected to support.

OpenMP 5.2 §B.4 p.634 l.3-4

The target update construct ... was modified to allow array sections that specify discontiguous storage

OpenMP 5.2 §5.8.3 p.155 l.10