OffTarget

Observed issues › fuzz/s1-2592-cce21

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

ftn: internal compiler error "Should never reach this code (doehmke)" for in_reduction on target reading a character substring

Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked

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/afails another wayfails another way
NVHPC 26.9n/an/an/an/an/afails another wayfails another way
GCC 16.2.0fails another wayfails another wayfails another wayfails another wayfails another wayfails another wayn/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      ::  Should never reach this code (doehmke)
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_util_misc.c', line 2697
   Initiated from     ::  Line 1849 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  s1-2592-cce21.f90
   Function           ::  kp1
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      ::  Should never reach this code (doehmke)
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_util_misc.c', line 2711
   Initiated from     ::  Line 1859 (v_main.c)
   Optimizer built    ::  2025-11-17 (production)
   File               ::  s1-2592-cce21.f90
   Function           ::  kp1
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      ::  Should never reach this code (doehmke)
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_util_misc.c', line 2719
   Initiated from     ::  Line 1939 (v_main.c)
   Optimizer built    ::  2026-07-14 (production)
   File               ::  s1-2592-cce21.f90
   Function           ::  kp1
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      ::  Should never reach this code (doehmke)
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_util_misc.c', line 2719
   Initiated from     ::  Line 1939 (v_main.c)
   Optimizer built    ::  2026-09-24 (production)
   File               ::  s1-2592-cce21.f90
   Function           ::  kp1
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
show
NVFORTRAN-S-0034-Syntax error at or near identifier task_reduction (s1-2592-cce21.f90: 18)
NVFORTRAN-S-0034-Syntax error at or near identifier in_reduction (s1-2592-cce21.f90: 19)
NVFORTRAN/x86-64 Linux 25.11-0: compilation completed with severe errors
fails another wayNVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-S-0034-Syntax error at or near identifier task_reduction (s1-2592-cce21.f90: 18)
NVFORTRAN-S-0034-Syntax error at or near identifier in_reduction (s1-2592-cce21.f90: 19)
NVFORTRAN/x86-64 Linux 26.9-0: compilation completed with severe errors
fails another wayGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
GCC 16.2.0, MI250X
GCC 16.2.0, MI300X
GCC 16.2.0, MI350X
GCC 16.2.0, A100 separate
show
libgomp: OMP_TARGET_OFFLOAD is set to MANDATORY, but device not found

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 (51 lines)
! Finding: CCE 19, 20, 21 internal compiler error "Should never
! reach this code (doehmke)" (v_mt_util_misc.c; line 2697 in 19.0.0, 2711
! in 20.0.2, 2719 in 21.0.3) on a target region with in_reduction(*: r),
! inside taskgroup task_reduction(*: r), that reads a substring of a
! character dummy (ichar(xs(1:1))). With a constant instead of the
! substring all three compile (data/evidence/dataenv_probe/ice/e2.f90).
!
! Legal OpenMP 5.2: in_reduction on target (5.2 §5.5.10), task_reduction on
! taskgroup (§5.5.9), a character dummy referenced in the region (mapped
! implicitly). (A gfortran -fopenmp accept is no evidence: rule of 2026-10-23.) Expected: ichar('k') =
! 107 and mod(107, 13) = 3, so every factor is 1 and r stays -1: "RESULT
! check=pass".
!
! Observed (tuolumne, MI300A, -O2, HSA_XNACK=1 and 0, 2026-10-23,
! results/t28_probe/ice_inred_char_substring.f90.*.json):
! - CCE 19.0.0, 20.0.2, 21.0.3: the ICE above, both modes;
! - AFAR amdflang 24.0.0git: "RESULT check=pass" in both modes;
! - Tioga MI250X (gfx90a, HSA_XNACK=0): CCE 21 the same ICE
!   (results/t28_probe/g90/ice_inred_char_substring.cce21_g90.json).
! Fuzz campaign s1: the "Should never reach this code (doehmke)" cells of
! CCE 19/20/21. Representative s1 seed 2592 on cce21; the confirmer's
! reduction (results/confirm/drafts/fuzz_s1_2592_cce21_gfx942_unified,
! 189 -> 98 lines, ICE kept) reduced further by hand.
!
! ftn -fopenmp -O2
program p
  implicit none
  integer, parameter :: n = 16
  character(len=8) :: xs
  integer :: r
  xs = 'kPACnWLl'
  r = -1
  call kp1(xs)
  if (r == -1) then
    print '(a)', 'RESULT check=pass'
  else
    print '(a,i0)', 'RESULT check=fail r=', r
  end if
contains
  subroutine kp1(xs)
    character(len=*), intent(in) :: xs
    integer :: i
    !$omp taskgroup task_reduction(*: r)
      !$omp target defaultmap(tofrom: scalar) in_reduction(*: r)
        do i = 1, n
          r = r * merge(-1, 1, mod(ichar(xs(1:1)), 13) == 0)
        end do
      !$omp end target
    !$omp end taskgroup
  end subroutine kp1
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 check=pass

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      ::  Should never reach this code (doehmke)
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_util_misc.c', line 2697
   Initiated from     ::  Line 1849 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  s1-2592-cce21.f90
   Function           ::  kp1

What the specification requires

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

OpenMP 5.2 §5.5.10

OpenMP 5.2 §5.5.9

Evidence

Same compiler, one change

  • ichar('k') instead of ichar(xs(1:1)): 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, parameter :: n = 16
      character(len=8) :: xs
      integer :: r
      xs = 'kPACnWLl'
      r = -1
      call kp1(xs)
      if (r == -1) then
        print '(a)', 'RESULT check=pass'
      else
        print '(a,i0)', 'RESULT check=fail r=', r
      end if
    contains
      subroutine kp1(xs)
        character(len=*), intent(in) :: xs
        integer :: i
        !$omp taskgroup task_reduction(*: r)
          !$omp target defaultmap(tofrom: scalar) in_reduction(*: r)
            do i = 1, n
              r = r * merge(-1, 1, mod(ichar('k'), 13) == 0)
            end do
          !$omp end target
        !$omp end taskgroup
      end subroutine kp1
    end program p
    

Other compilers run it correctly

AFAR 24.3.0