OffTarget

Observed issues › cce21-linear-modifier-default-none

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

ftn: internal compiler error "ACC - barrier/reset/protected last private not supported" for linear and lastprivate on a loop in a target region

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

Same issue as catalog/cce-linear-lastprivate-ice; this program is another reproducer of it.

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 wayfails another wayfails another wayfails another wayn/an/a
CCE 19.0.0fails another wayfails another wayfails another wayunknown
not run
unknown
not run
n/an/a
CCE 20.0.2fails another wayfails another wayfails another wayunknown
not run
unknown
not run
n/an/a
CCE 21.0.3not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 21.0.4not supportednot supportednot supportedunknown
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.0correctcorrectcorrectcorrectcorrectcorrectn/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 supportedCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.3, MI250X
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
CCE 21.0.4, MI250X
show
Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
      b(i) = 2*a(i) + 1 + (x - (i + 2))
                           ^            
ftn-1510 ftn: ERROR P, File = cce21-linear-modifier-default-none.f90, Line = 14, Column = 28 
  Variable "X" must have its data scope explicitly declared because DEFAULT(NONE) was specified.
Cray Fortran : 20 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
fails another wayAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
show
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: $AFAR/lib/llvm/bin/flang-24 -fc1 -triple amdgpu9.42-amd-amdhsa -emit-llvm-bc -fno-color-diagnostics -flto=full -mrelocation-model pic -pic-level 2 -target-cpu gfx942 -mlink-built
 #0 0x0000155543273e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) ($AFAR/lib/llvm/bin/../lib/libLLVM.so.24.0git+0x88ce6a)
 #1 0x0000155543270b46 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000155555116990 __restore_rt (/lib64/libpthread.so.0+0x12990)
 #3 0x00001555443d6eb2 llvm::CodeExtractorAnalysisCache::findSideEffectInfoForBlock(llvm::BasicBlock&) ($AFAR/lib/llvm/bin/../lib/libLLVM.so.24.0git+0x19efeb2)
 #4 0x00001555443d759e llvm::CodeExtractorAnalysisCache::CodeExtractorAnalysisCache(llvm::Function&) ($AFAR/lib/llvm/bin/../lib/libLLVM.so.24.0git+0x19f059e)
fails another wayAFAR 24.3.0, MI250X
show
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: $AFAR/lib/llvm/bin/flang-24 -fc1 -triple amdgpu9.0a-amd-amdhsa -emit-llvm-bc -fno-color-diagnostics -flto=full -mrelocation-model pic -pic-level 2 -target-cpu gfx90a -mlink-built
 #0 0x0000155543273e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) ($AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x88ce6a)
 #1 0x0000155543270b46 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000155555116990 __restore_rt (/lib64/libpthread.so.0+0x12990)
 #3 0x00001555443d6eb2 llvm::CodeExtractorAnalysisCache::findSideEffectInfoForBlock(llvm::BasicBlock&) ($AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19efeb2)
 #4 0x00001555443d759e llvm::CodeExtractorAnalysisCache::CodeExtractorAnalysisCache(llvm::Function&) ($AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19f059e)
fails another wayAFAR 24.3.0, MI300X
show
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: $AFAR/lib/llvm/bin/flang-24 -fc1 -triple amdgpu9.42-amd-amdhsa -emit-llvm-bc -fno-color-diagnostics -flto=full -mrelocation-model pic -pic-level 2 -target-cpu gfx942 -mlink-built
 #0 0x00007fb68428ce6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x88ce6a)
 #1 0x00007fb684289b46 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007fb68323ebf0 __restore_rt (/lib64/libc.so.6+0x3ebf0)
 #3 0x00007fb6853efeb2 llvm::CodeExtractorAnalysisCache::findSideEffectInfoForBlock(llvm::BasicBlock&) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19efeb2)
 #4 0x00007fb6853f059e llvm::CodeExtractorAnalysisCache::CodeExtractorAnalysisCache(llvm::Function&) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19f059e)
fails another wayAFAR 24.3.0, MI350X
show
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: $AFAR/lib/llvm/bin/flang-24 -fc1 -triple amdgpu9.50-amd-amdhsa -emit-llvm-bc -fno-color-diagnostics -flto=full -mrelocation-model pic -pic-level 2 -target-cpu gfx950 -mlink-built
 #0 0x00007fcda3e8ce6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x88ce6a)
 #1 0x00007fcda3e89b46 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007fcda2e3fc30 __restore_rt (/lib64/libc.so.6+0x3fc30)
 #3 0x00007fcda4fefeb2 llvm::CodeExtractorAnalysisCache::findSideEffectInfoForBlock(llvm::BasicBlock&) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19efeb2)
 #4 0x00007fcda4ff059e llvm::CodeExtractorAnalysisCache::CodeExtractorAnalysisCache(llvm::Function&) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19f059e)
fails another wayCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
CCE 19.0.0, MI250X
show
Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
    !$omp parallel do default(none) shared(a, b) linear(x: val, step(1))
                                                           ^             
ftn-113 ftn: ERROR P, File = cce21-linear-modifier-default-none.f90, Line = 12, Column = 60 
  IMPLICIT NONE is specified in the local scope, therefore an explicit type must be specified for data object "VAL".
                                                           ^             
ftn-800 ftn: ERROR P, File = cce21-linear-modifier-default-none.f90, Line = 12, Column = 60 
fails another wayCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
CCE 20.0.2, MI250X
show
Warning:
 Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable..
    !$omp parallel do default(none) shared(a, b) linear(x: val, step(1))
                                                           ^             
ftn-113 ftn: ERROR P, File = cce21-linear-modifier-default-none.f90, Line = 12, Column = 60 
  IMPLICIT NONE is specified in the local scope, therefore an explicit type must be specified for data object "VAL".
                                                           ^             
ftn-800 ftn: ERROR P, File = cce21-linear-modifier-default-none.f90, Line = 12, Column = 60 
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 , (cce21-linear-modifier-default-none.f90: 12)
  0 inform,   0 warnings,   1 severes, 0 fatal for p

Reproduce

CCE 21.0.3, MI300A unified

module load cce/21.0.3 craype-accel-amd-gfx942 rocm/7.2.0
module unload cray-mpich
ftn -fopenmp -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

CCE 21.0.4, MI300A unified

module load cce/21.0.4 craype-accel-amd-gfx942 rocm/7.2.0
module unload cray-mpich
ftn -fopenmp -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

GCC 16.2.0, MI300A unified (runs correctly)

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
Program (54 lines)
! Finding: CCE 21 rejects the OpenMP 5.2 linear modifier syntax
! under default(none) with a false data-sharing diagnostic.
!
! Legal OpenMP 5.2: linear(x: val, step(1)) on a worksharing-loop (5.2
! §5.4.6 pp.117-120; val is the default for a non-reference variable).
! linear is a data-sharing attribute clause, so x has an explicitly
! determined data-sharing attribute and default(none) is satisfied (5.2
! §5.4.1 p.109). At the start of iteration i, x = 3 + (i - 1); after the
! loop x = n + 3, reading "The value corresponding to the sequentially last
! logical iteration of the associated loops is assigned to the original list
! item" (5.2 §5.4.6 p.118) as the list item's value at the end of that
! iteration, as for lastprivate (the other reading, its value at the start,
! gives n + 2; CCE 21's failure is a compile-time rejection either way).
! Expected: "RESULT ran_on_host=0 check=pass".
! Legality rests on the quoted spec text: cited gfortran 13.3.1
! -fopenmp as an independent witness; gfortran/gcc -fopenmp are withdrawn
! as offload legality witnesses (data/reports/rulings.md).
!
! Observed (tuolumne, MI300A, both memory modes, -O2, 2026-10-22,
! data/evidence/triage_probe/linear_mod.f90 and linear_mod_nodn.f90,
! results/t27b/probes.jsonl):
! - CCE 21.0.3 (whose intro_openmp(7) lists "new linear clause syntax
!   (Fortran only)" among its OpenMP 5.2 features): ftn-1510 "Variable "X"
!   must have its data scope explicitly declared because DEFAULT(NONE) was
!   specified". Without default(none) shared(a, b): internal compiler error
!   "ACC - barrier/reset/protected last private not supported" (the class of
!   fuzz/1391-cce20.f90).
! - CCE 19.0.0, 20.0.2: ftn-113, VAL read as an undeclared variable (they do
!   not claim the 5.2 syntax).
! - AFAR amdflang 24.0.0git: crashes (ICE) in both forms.
! The catalog's omp52/60-clause-linear-val programs are rejected on every
! compiler because of these.
!
! ftn -fopenmp -O2
program p
  use omp_lib, only: omp_is_initial_device
  implicit none
  integer, parameter :: n = 64
  integer :: a(n), b(n), i, x, host_flag
  a = [(i, i = 1, n)]
  b = 0
  x = 3
  host_flag = 1
  !$omp target map(to: a) map(from: b) map(tofrom: x, host_flag)
    host_flag = merge(1, 0, omp_is_initial_device())
    !$omp parallel do default(none) shared(a, b) linear(x: val, step(1))
    do i = 1, n
      b(i) = 2*a(i) + 1 + (x - (i + 2))
      x = x + 1
    end do
  !$omp end target
  print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', &
    merge('pass', 'fail', all(b == 2*a + 1) .and. x == n + 3)
end program p

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

RESULT ran_on_host=0 check=pass

Observed where it behaves incorrectly

Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
      b(i) = 2*a(i) + 1 + (x - (i + 2))
                           ^            
ftn-1510 ftn: ERROR P, File = cce21-linear-modifier-default-none.f90, Line = 14, Column = 28 
  Variable "X" must have its data scope explicitly declared because DEFAULT(NONE) was specified.
Cray Fortran : 20 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi

What the specification requires

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

OpenMP 5.2 §5.4.6 p.117-120

OpenMP 5.2 §5.4.1 p.109

OpenMP 5.2 §5.4.6 p.118

The value corresponding to the sequentially last logical iteration of the associated loops is assigned to the original list item

Evidence

Other compilers run it correctly

GCC 16.2.0