OffTarget

Observed issues › nvhpc-acc-atomic-update-sum-fort2-crash

Appears to behave incorrectlyCompiler crash · Fortran · OpenACC · Open

nvc/nvfortran -acc: atomic update x = x + v + 1 rejected, then internal compiler error (nvc) or fort2 crash (nvfortran)

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

Same issue as nvhpc-c-acc-atomic-update-sum-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.0n/an/an/an/an/an/an/a
CCE 19.0.0correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
NVHPC 25.11n/an/an/an/an/abehaves incorrectlybehaves incorrectly
NVHPC 26.9n/an/an/an/an/abehaves incorrectlybehaves incorrectly
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 incorrectlyNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
show
NVFORTRAN-S-0155-Invalid atomic update expression  (nvhpc-acc-atomic-update-sum-fort2-crash.f90: 13)
nvfortran-Fatal-$NVHPC_25_11/compilers/bin/tools/fort2 TERMINATED by signal 11
behaves incorrectlyNVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-S-0155-Invalid atomic update expression  (nvhpc-acc-atomic-update-sum-fort2-crash.f90: 13)
nvfortran-Fatal-$NVHPC_26_9/compilers/bin/tools/fort2 TERMINATED by signal 11

Reproduce

NVHPC 25.11, A100 separate

export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib
nvfortran -acc=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro
./repro

NVHPC 26.9, A100 separate

export LD_LIBRARY_PATH=$NVHPC_26_9/compilers/lib
nvfortran -acc=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro
./repro

CCE 19.0.0, MI300A unified (runs correctly)

module load cce/19.0.0 craype-accel-amd-gfx942 rocm/6.4.3
module unload cray-mpich
ftn -h acc -O2 repro.f90 -o repro
HSA_XNACK=1 ./repro
Program (46 lines)
! NVHPC 25.11 and 26.9 (nvfortran), NVIDIA A100 80GB PCIe
! (wingtip, sm_80): the Fortran form of nvhpc-c-acc-atomic-update-sum-ice.c.
! nvfortran rejects the OpenACC atomic update b(i) = b(i) + 2*a(i) + 1
! ("NVFORTRAN-S-0155-Invalid atomic update expression"), and in a gang loop
! its front end then crashes ("nvfortran-Fatal-.../maintainers/fort2 TERMINATED by
! signal 11"), at -O0 and -O2, for -acc=gpu and -acc=multicore. In a plain
! parallel loop on a scalar (x = x + v + 1) it only rejects ("Invalid atomic
! update expression", "Invalid atomic region"), without the crash.
! Spec: one Fortran form of an atomic update is "x = x operator expr", and
! "The expression x operator expr must be mathematically equivalent to x
! operator (expr). This requirement is satisfied if the operators in expr
! have precedence greater than operator, or by using parentheses around expr
! or subexpressions of expr" (OpenACC 3.4 §2.12, p.79-80).
! b(i) + 2*a(i) + 1 is (b(i) + 2*a(i)) + 1, which is b(i) + (2*a(i) + 1) for
! integers: the precedence and parentheses forms are sufficient, not
! necessary, so the statement is a legal update. Written
! b(i) = b(i) + (2*a(i) + 1) it compiles and gives sum=4224.
! Expected: "sum=4224" (a diagnostic would at least not be a crash).
! Observed (2026-10-25, nvfortran 25.11-0 and 26.9-0, the flags below and
! -O0, -acc=multicore): compile exit status 2 with the two messages above,
! on both releases (log: data/evidence/acc_c_probe/atomic/run.log, gang.f90).
! Found by the catalog: acc34-clause-gang, acc34-clause-gang-dim and
! acc34-directive-loop, all gang loops: the front end crashes in 11 of their
! 12 NVHPC cells (gang-dim on 25.11 in separate memory rejects without the
! crash; results/acc_matrix.jsonl); reduced by hand. That rejection without the crash was 1 compile in 157;
! the other 156 (the gate's reruns and the later repeats) crashed
! (data/evidence/gate_probe/logs/wingtip1-4.log): the 12th cell crashes too, not
! every time.
! NVHPC: nvfortran -acc=gpu -gpu=cc80 -gpu=mem:separate -O2
program p
  implicit none
  integer, parameter :: n = 64
  integer :: a(n), b(n), i
  do i = 1, n
    a(i) = i
    b(i) = 0
  end do
  !$acc parallel num_gangs(4) copyin(a) copy(b)
  !$acc loop gang
  do i = 1, n
    !$acc atomic update
    b(i) = b(i) + 2*a(i) + 1
  end do
  !$acc end parallel
  print '(a,i0)', 'sum=', sum(b)
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

check=pass

Observed where it behaves incorrectly

NVFORTRAN-S-0155-Invalid atomic update expression  (nvhpc-acc-atomic-update-sum-fort2-crash.f90: 13)
nvfortran-Fatal-$NVHPC_25_11/compilers/bin/tools/fort2 TERMINATED by signal 11

What the specification requires

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

OpenACC 3.4 §2.12 p.79-80

The expression x operator expr must be mathematically equivalent to x operator (expr). This requirement is satisfied if the operators in expr have precedence greater than operator, or by using parentheses around expr or subexpressions of expr

Evidence

Same compiler, one change

  • b(i) = b(i) + (2*a(i) + 1), the right-hand side in parentheses: CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct; NVHPC 25.11: correct; NVHPC 26.9: correct
    Control program
    program p
      implicit none
      integer, parameter :: n = 64
      integer :: a(n), b(n), i
      do i = 1, n
        a(i) = i
        b(i) = 0
      end do
      !$acc parallel num_gangs(4) copyin(a) copy(b)
      !$acc loop gang
      do i = 1, n
        !$acc atomic update
        b(i) = b(i) + (2*a(i) + 1)
      end do
      !$acc end parallel
      print '(a,i0)', 'sum=', sum(b)
    end program p
    

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, GCC 16.2.0