OffTarget

Observed issues › fresh/cce-if-stop-in-target-ice-one-condition

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

ftn: an IF statement guarding STOP in device code: the STOP runs although its condition is false (target loop), or an internal compiler error (directly in a target region)

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

Same issue as catalog/cce-flang-stop-in-target-crash; 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.0correctcorrectcorrectcorrectcorrectn/an/a
CCE 19.0.0behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 20.0.2behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 21.0.3behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 21.0.4behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
NVHPC 25.11n/an/an/an/an/acorrectcorrect
NVHPC 26.9n/an/an/an/an/acorrectcorrect
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
behaves incorrectlyCCE 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..
   Error message      ::  COND PDG 20 with no stmts.
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_fs.c', line 2323
   Initiated from     ::  Line 862 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  cce-if-stop-in-target-ice-one-condition.f90
   Function           ::  p
behaves incorrectlyCCE 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..
   Error message      ::  COND PDG 20 with no stmts.
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_fs.c', line 2325
   Initiated from     ::  Line 862 (v_main.c)
   Optimizer built    ::  2025-11-17 (production)
   File               ::  cce-if-stop-in-target-ice-one-condition.f90
   Function           ::  p
behaves incorrectlyCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.3, MI250X
show
Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
   Error message      ::  COND PDG 20 with no stmts.
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_fs.c', line 2325
   Initiated from     ::  Line 934 (v_main.c)
   Optimizer built    ::  2026-07-14 (production)
   File               ::  cce-if-stop-in-target-ice-one-condition.f90
   Function           ::  p
behaves incorrectlyCCE 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..
   Error message      ::  COND PDG 20 with no stmts.
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_fs.c', line 2325
   Initiated from     ::  Line 934 (v_main.c)
   Optimizer built    ::  2026-09-24 (production)
   File               ::  cce-if-stop-in-target-ice-one-condition.f90
   Function           ::  p

Reproduce

CCE 19.0.0, MI300A unified

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

CCE 20.0.2, MI300A unified

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

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

AFAR 24.3.0, MI300A unified (runs correctly)

$AFAR/bin/amdflang -fopenmp --offload-arch=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (31 lines)
! # Finding (from the data/bench/fresh draft fresh-106): CCE ICE on an IF with one
!   operand that guards a STOP directly in a target region
!
! - the one-operand form of fresh/cce-if-stop-in-target-ice.f90 (see its header for the source):
!   `if (x /= 1) stop 1` directly in a target region; `if (allocated(j)) stop 1`,
!   `if (.not. allocated(j)) stop 1` and `if (allocated(j)) error stop 1` give the same ICE
!   (data/reports/fresh-drafts/d106-e2.f90, d106-e7.f90, d106-e6.f90; CCE 21 rejects the ERROR STOP
!   instead: "Non-localized coarray control/access statements are not allowed in an OpenMP
!   explicit region")
! - compilers: CCE 19.0.0, 20.0.2 and 21.0.3 ftn, -fopenmp -O2 (gfx942 and gfx90a)
! - expected: compiles and prints x 11 (OpenMP 5.2 §4.3 p.76 l.13-21: "A structured block ... may
!   contain STOP or ERROR STOP statements"); x is 1 on entry, so the STOP is not reached
! - actual: INTERNAL COMPILER ERROR "COND PDG 20 with no stmts." (pdgcs/v_fs.c line 2323 in CCE 19,
!   2325 in CCE 20 and 21)
! - control (same compiler): `if (x /= 1) x = -100` (data/reports/fresh-drafts/d106-r1-ctl.f90)
!   compiles and prints x 11
! - other families: AFAR compiles and prints x 11 (MI300A HSA_XNACK 1 and 0; MI250X)
! - related: catalog/cce-flang-stop-in-target-crash.f90
! - legality: legal by reading
! - evidence: results/fresh-drafts/tuo4-r*.jsonl, tioga/<host>.jsonl (d106-r1.f90, identical to the
!   program below), tuo2-q1.jsonl (d106-e3.f90, the same with an unused allocatable) (review)
program p
  implicit none
  integer :: x
  x = 1
  !$omp target map(tofrom: x)
    if (x /= 1) stop 1
    x = 11
  !$omp end target
  print *, 'x', x
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

Observed where it behaves incorrectly

Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
   Error message      ::  COND PDG 20 with no stmts.
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_fs.c', line 2323
   Initiated from     ::  Line 862 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  cce-if-stop-in-target-ice-one-condition.f90
   Function           ::  p

What the specification requires

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

OpenMP 5.2 §4.3 p.76 l.13-21

A structured block ... may contain STOP or ERROR STOP statements

Evidence

Same compiler, one change

  • the IF with an assignment instead of STOP: AFAR 24.3.0: correct; CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct
    Control program
    program p
      implicit none
      integer :: x
      x = 1
      !$omp target map(tofrom: x)
        if (x /= 1) x = -100
        x = 11
      !$omp end target
      print *, 'x', x
    end program p
    

Other compilers run it correctly

AFAR 24.3.0, NVHPC 25.11, NVHPC 26.9, GCC 16.2.0