Observed issues › gcc/gcc-acc-init-set-shutdown-rejected
gfortran: OpenACC init, set and shutdown directives are not accepted ("Unclassifiable OpenACC directive")
Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked
GCC 16.2's Fortran front end does not parse the OpenACC init, set and shutdown directives ("Unclassifiable OpenACC directive"); the C front end accepts them. These directives are part of OpenACC 2.5, and GCC documents OpenACC 2.6. NVHPC compiles and runs the programs.
Affected variants
| Compiler | MI300A 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.0 | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
| CCE 19.0.0 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| NVHPC 25.11 | n/a | n/a | n/a | n/a | n/a | correct | correct |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | correct | correct |
| GCC 16.2.0 | not supported | not supported | not supported | not supported | not supported | not supported | n/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
| Result | Compiler and GPU | Message |
|---|---|---|
| not supported | GCC 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 | showsite-gcc--gcc-acc-init-set-shutdown-rejected.f90:55:9:
55 | !$acc init
| 1
Error: Unclassifiable OpenACC directive at (1) |
| fails another way | CCE 19.0.0, MI300A unified CCE 19.0.0, MI300A copy | showrepro: libcrayacc/acc_runtime.c:4171: void _cray_acc_init_device(acc_device_t, int): Assertion `(device_type == CurrentHardware->get_device_type()) && "Incorrect device type set !!!"' failed. |
| fails another way | CCE 20.0.2, MI300A unified CCE 20.0.2, MI300A copy | showrepro: libcrayacc/acc_runtime.c:4368: void _cray_acc_init_device(acc_device_t, int): Assertion `(device_type == CurrentHardware->get_device_type()) && "Incorrect device type set !!!"' failed. |
| fails another way | CCE 21.0.3, MI300A unified CCE 21.0.3, MI300A copy CCE 21.0.4, MI300A unified CCE 21.0.4, MI300A copy | showrepro: libcrayacc/acc_runtime.c:4450: void _cray_acc_init_device(acc_device_t, int): Assertion `(device_type == CurrentHardware->get_device_type()) && "Incorrect device type set !!!"' failed. |
Reproduce
GCC 16.2.0, MI300A unified
export LD_LIBRARY_PATH=$GCC_16_2/lib64:/opt/rocm-7.2.1/lib $GCC_16_2/bin/gfortran -fopenacc -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx942 -O2 repro.f90 -o repro HSA_XNACK=1 ./repro
GCC 16.2.0, A100 separate
export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=$GCC_16_2/lib64 $GCC_16_2/bin/gfortran -fopenacc -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 repro.f90 -o repro ./repro
NVHPC 25.11, A100 separate (runs correctly)
export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib nvfortran -acc=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro ./repro
Program (64 lines)
! # Finding (GCC 16.2): gfortran does not accept the OpenACC init, set and shutdown directives; the reproducer is the catalog
! program acc34-directive-init
!
! - toolchains: gcc_g90 (GCC 16.2.0, AMD Instinct MI250X gfx90a, Tioga) and gcc_sm80 (GCC 16.2.0,
! NVIDIA A100 sm_80, wingtip); separate memory only; -O2; OMP_TARGET_OFFLOAD=mandatory
! - build: gfortran -fopenacc -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx90a -O2 (gcc_g90);
! -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 (gcc_sm80)
! - failure: rejected: Unclassifiable OpenACC directive
! - observed: `Error: Unclassifiable OpenACC directive at (1)` at `!$acc init` (also `!$acc set`, `!$acc shutdown`, and set's
! default_async and device_num clauses), on both GPUs. The C programs of the same directives compile.
! - expected: compiles; `RESULT ran_on_host=0 check=pass`
! - spec: the init directive (OpenACC 3.4 §2.14.1 l.3089-3100), "In Fortran the syntax of the init directive is: !$acc init
! [clause-list]"; the shutdown directive (§2.14.2) and the set directive (§2.14.3). They were added in OpenACC 2.5 (the
! specification's "Changes from Version 2.0 to 2.5", margin lines 590-591).
! - GCC 16.2 documentation (libgomp.texi "Enabling OpenACC"): "A complete description of all OpenACC directives accepted may be
! found in the OpenACC Application Programming Interface manual, version 2.6"; _OPENACC is 201711 (2.6). No list of OpenACC gaps
! is documented.
! - other families: NVHPC 25.11/26.9 compile and run the programs (separate and managed memory); CCE 19/20/21 compile them and abort
! at run time (cce-acc-init-set-runtime-assert.f90).
! - gate and confirmer: 10 cells (5 gcc_g90, 5 gcc_sm80), each confirmed in the gate's four environments (a-d;
! results/gcc/gate-tioga/ and gate-wingtip/ verdicts.jsonl); confirmer verdicts (results/gcc/confirm/batch.gcc_*.jsonl):
! compiler_bug (R11-compile-rejection) 10
! - catalog programs (5): acc34-clause-default_async, acc34-clause-device_num, acc34-directive-init, acc34-directive-set,
! acc34-directive-shutdown
! - legality: the catalog programs are legal by construction (offload.engine.gen, c_gen and acc_gen
! check every program against the catalog rules and the offload scope as it is built; no
! compiler). GCC is a compiler under test only: never a legality witness, here or for another
! family's case (catalog/machines.yaml under_test_only).
! Generated by compliance.gen (OpenACC 3.4, free-form Fortran). Do not edit.
! id: acc34-directive-init
! primary atom: acc.directive.init
! legal: yes
! observable: no (unverified: the check covers the device kernel, not the atom)
! ran_on_host: inside the compute region of interest (acc_on_device)
! evidence: unverified
! needs: none
! std: f2008
! unverified (needs_other_infrastructure): initialisation is observable only as timing or through the profiling interface (3.4
! chapter 5); the runtime initialises on first use anyway
program gen_prog
use openacc, only: acc_device_host, acc_on_device
implicit none
integer, parameter :: n = 64
integer, allocatable, target :: a(:), b(:)
integer :: ref(n)
integer :: i, host_flag
logical :: ok
allocate(a(n), b(n))
do i = 1, n
a(i) = i
b(i) = 0
ref(i) = 2*i + 1
end do
host_flag = 1
!$acc init
!$acc parallel loop copyin(a) copyout(b) copy(host_flag)
do i = 1, n
if (i == 1) host_flag = merge(1, 0, acc_on_device(acc_device_host))
b(i) = 2*a(i) + 1
end do
ok = all(b == ref)
print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
deallocate(a, b)
end program gen_prog
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
site-gcc--gcc-acc-init-set-shutdown-rejected.f90:55:9:
55 | !$acc init
| 1
Error: Unclassifiable OpenACC directive at (1)What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenACC 3.4 §2.14.1
OpenACC 3.4 §2.14.2
OpenACC 3.4 §2.14.3
Evidence
Other compilers run it correctly
NVHPC 25.11, NVHPC 26.9