OffTarget

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

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      ::  Condition statement not found in condition node
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_region.c', line 636
   Initiated from     ::  Line 837 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  cce-if-stop-in-target-ice.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      ::  Condition statement not found in condition node
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_region.c', line 636
   Initiated from     ::  Line 837 (v_main.c)
   Optimizer built    ::  2025-11-17 (production)
   File               ::  cce-if-stop-in-target-ice.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      ::  Condition statement not found in condition node
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_region.c', line 646
   Initiated from     ::  Line 909 (v_main.c)
   Optimizer built    ::  2026-07-14 (production)
   File               ::  cce-if-stop-in-target-ice.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      ::  Condition statement not found in condition node
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_region.c', line 646
   Initiated from     ::  Line 909 (v_main.c)
   Optimizer built    ::  2026-09-24 (production)
   File               ::  cce-if-stop-in-target-ice.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 (37 lines)
! # Finding (from the data/bench/fresh draft fresh-106): CCE ICE on an IF that guards a STOP
!   directly in a target region
!
! - source: data/bench/fresh/fresh-106.f90 (GCC Bugzilla 119905, libgomp map-alloc-comp-11.f90:
!   recursive allocatable components, checks that end in STOP inside the target region). The ICE
!   needs neither the derived types nor ALLOCATED: it needs an IF whose action is STOP, directly in
!   a target region (not inside a loop construct: the catalog's `if (a(i) < 0) stop 1` inside
!   target teams distribute parallel do compiles, see Related). With two operands joined by .or.
!   (this file) the ICE is the draft's; with one operand it is another ICE
!   (fresh/cce-if-stop-in-target-ice-one-condition.f90)
! - compilers: CCE 19.0.0, 20.0.2 and 21.0.3 ftn, -fopenmp -O2 (gfx942 and gfx90a)
! - expected: compiles and prints x 11. "A structured block ... may contain STOP or ERROR STOP
!   statements" (OpenMP 5.2 §4.3 p.76 l.13-21); x is 1 on entry, so the STOP is not reached
! - actual: INTERNAL COMPILER ERROR "Condition statement not found in condition node"
!   (pdgcs/v_region.c line 636 in CCE 19 and 20, line 646 in CCE 21), the ICE of the draft
! - control (same compiler): the same IF with an assignment instead of the STOP,
!   `if (x /= 1 .or. x > 5) x = -100` (data/reports/fresh-drafts/d106-r2-ctl.f90), compiles and
!   prints x 11
! - other families: AFAR compiles and prints x 11 (MI300A HSA_XNACK 1 and 0; MI250X). NVHPC rejects
!   the draft's recursive allocatable components (a Fortran 2008 feature)
! - related: catalog/cce-flang-stop-in-target-crash.f90 (an unreached IF ... STOP inside a target
!   loop compiles, and the device executes the STOP): the same construct, a different outcome,
!   plausibly the same root cause (the condition of an IF whose action is STOP is lost)
! - legality: legal by reading
! - evidence: results/fresh-drafts/tuo4-r*.jsonl, tioga/<host>.jsonl (d106-r2.f90, identical to the
!   program below), tuo2-q1.jsonl, tuo3-r*-c.jsonl, tioga/tioga-d.jsonl (d106-e4.f90, the same with an
!   unused allocatable) (review)
program p
  implicit none
  integer :: x
  x = 1
  !$omp target map(tofrom: x)
    if (x /= 1 .or. x > 5) 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      ::  Condition statement not found in condition node
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_region.c', line 636
   Initiated from     ::  Line 837 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  cce-if-stop-in-target-ice.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 .or. x > 5) 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