Observed issues › oop/gcc-pdt-length-parameter-abort
mapping a derived type with a length type parameter aborts
Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked
A variable of a parameterized derived type with a length type parameter, mapped tofrom, makes the program abort at run time with GCC 16.2. A kind type parameter works.
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 | fails another way | fails another way | unknown not run | fails another way | fails another way | 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 | behaves incorrectly | correct |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | behaves incorrectly | correct |
| GCC 16.2.0 | correct | behaves incorrectly | behaves incorrectly | behaves incorrectly | behaves incorrectly | behaves incorrectly | 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 |
|---|---|---|
| behaves incorrectly | NVHPC 25.11, A100 separate NVHPC 26.9, A100 separate | showFailing in Thread:1 Accelerator Fatal Error: call to cuMemcpyDtoHAsync returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution File: <dir> Function: oop:31 Line: 52 |
| behaves incorrectly | GCC 16.2.0, MI300A copy | showMemory access fault by GPU node-7 (Agent handle: 0x590c10) on address 0x53d000. Reason: Unknown. Program received signal SIGABRT: Process abort signal. Backtrace for this error: #0 0x15555469662f in ??? #1 0x1555546965af in ??? #2 0x155554669ee4 in ??? #3 0x1555540d6bfe in ??? #4 0x1555540d4288 in ??? |
| behaves incorrectly | GCC 16.2.0, MI250X | showMemory access fault by GPU node-4 (Agent handle: 0x7830d0) on address 0x737000. Reason: Unknown. Program received signal SIGABRT: Process abort signal. Backtrace for this error: #0 0x15555469662f in ??? #1 0x1555546965af in ??? #2 0x155554669ee4 in ??? #3 0x1555540d6bfe in ??? #4 0x1555540d4288 in ??? |
| behaves incorrectly | GCC 16.2.0, MI300X | showMemory access fault by GPU node-1 (Agent handle: 0x1ee9f50) on address 0x1eca000. Reason: Unknown. Program received signal SIGABRT: Process abort signal. Backtrace for this error: #0 0x7f4e1823ebef in ??? #1 0x7f4e1828bedc in ??? #2 0x7f4e1823eb45 in ??? #3 0x7f4e18228832 in ??? #4 0x7f4e17e89a5e in ??? |
| behaves incorrectly | GCC 16.2.0, MI350X | showMemory access fault by GPU node-1 (Agent handle: 0x889610) on address 0x868000. Reason: Unknown. Program received signal SIGABRT: Process abort signal. Backtrace for this error: #0 0x7fb60e83fc2f in ??? #1 0x7fb60e88d02c in ??? #2 0x7fb60e83fb85 in ??? #3 0x7fb60e829872 in ??? #4 0x7fb60e489a5e in ??? |
| behaves incorrectly | GCC 16.2.0, A100 separate | showlibgomp: cuCtxSynchronize error: an illegal memory access was encountered libgomp: cuModuleGetFunction (__do_global_dtors__entry) error: an illegal memory access was encountered libgomp: cuMemFree_v2 error: an illegal memory access was encountered libgomp: device finalization failed |
| fails another way | AFAR 24.3.0, MI300A unified AFAR 24.3.0, MI300A copy | showerror: loc("site-oop--gcc-pdt-length-parameter-abort.f90":20:8): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/ConvertType.cpp:470: not yet implemented: parameterized derived types
LLVM ERROR: aborting |
| fails another way | AFAR 24.3.0, MI300X AFAR 24.3.0, MI350X | showerror: loc("site-oop--gcc-pdt-length-parameter-abort.f90":27:8): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/ConvertType.cpp:470: not yet implemented: parameterized derived types
LLVM ERROR: aborting |
| fails another way | CCE 19.0.0, MI300A unified CCE 19.0.0, MI300A copy | showWarning:
Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
module oop_m
^
ftn-855 ftn: ERROR OOP_M, File = site-oop--gcc-pdt-length-parameter-abort.f90, Line = 17, Column = 8
The compiler has detected errors in module "OOP_M". No module information file will be created for this module.
type lv(m)
^ |
| fails another way | CCE 20.0.2, MI300A unified CCE 20.0.2, MI300A copy | showWarning:
Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable..
module oop_m
^
ftn-855 ftn: ERROR OOP_M, File = site-oop--gcc-pdt-length-parameter-abort.f90, Line = 17, Column = 8
The compiler has detected errors in module "OOP_M". No module information file will be created for this module.
type lv(m)
^ |
| 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 | showWarning:
Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
module oop_m
^
ftn-855 ftn: ERROR OOP_M, File = site-oop--gcc-pdt-length-parameter-abort.f90, Line = 17, Column = 8
The compiler has detected errors in module "OOP_M". No module information file will be created for this module.
type lv(m)
^ |
Reproduce
NVHPC 25.11, A100 separate
export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib nvfortran -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro OMP_TARGET_OFFLOAD=mandatory ./repro
NVHPC 26.9, A100 separate
export LD_LIBRARY_PATH=$NVHPC_26_9/compilers/lib nvfortran -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro OMP_TARGET_OFFLOAD=mandatory ./repro
GCC 16.2.0, MI300A copy
export LD_LIBRARY_PATH=$GCC_16_2/lib64:/opt/rocm-7.2.1/lib $GCC_16_2/bin/gfortran -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx942 -O2 repro.f90 -o repro HSA_XNACK=0 OMP_TARGET_OFFLOAD=mandatory ./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 -fopenmp -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 repro.f90 -o repro OMP_TARGET_OFFLOAD=mandatory ./repro
NVHPC 25.11, A100 managed (runs correctly)
export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib nvfortran -mp=gpu -gpu=cc80 -gpu=mem:managed -O2 repro.f90 -o repro OMP_TARGET_OFFLOAD=mandatory ./repro
Program (62 lines)
! # Finding (fortran-oop): mapping a derived type with a length type parameter aborts at run time
!
! - toolchains and modes that fail: gcc_g90 (GCC 16.2 (gfx90a): copy), gcc_sm80 (GCC 16.2 (sm_80): copy); -O2
! - build: gfortran -fopenmp -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 (gcc_sm80)
! - failure: crash (SIGABRT); OMP_TARGET_OFFLOAD=mandatory
! - observed: compiles; aborts (SIGABRT) in every run; the deferred-length allocatable form (oop-pdt-deferred) aborts in some runs
! only (nondeterministic in the gate, not counted)
! - expected: `r1= 16 r2= 1496`
! - rule: 5.2 §5.8.3 p.155 l.5-7
! - same-compiler control: the same program without the target construct (controls/pdt-len-host.f90, one change: the PDT work runs
! on the host): `r1= 16 r2= 1496`, check=pass in the stored run and the gate's four environments on both machines
! (results/oop/probe/ctl2.*.pdt-len-host.gcc.jsonl, results/oop/probe/ctl2.*.pdt-len-host.wt-gcc_sm80.jsonl), so the abort is
! the offload's; a
! kind type parameter only (controls/pdt-kind.f90) is correct too (results/oop/main/rows.part*.jsonl)
! - other families: AFAR (not implemented) and CCE (ftn-1853) reject the programs
! - gate and confirmer: 6 cells, 6 confirmed in the gate's four environments (a-d; results/oop/main/gate_reruns*.jsonl); confirmer
! (results/oop/main/confirm.jsonl): needs_human (R22-expected-weak) 6; R22-expected-weak means the expected value has one
! source, the generator's Python model; the values follow from the program's arithmetic (checked by hand), and NVHPC 25.11,
! NVHPC 26.9 print them on this program
! - programs (3): oop-pdt-len, oop-pdt-array, oop-pdt-kindlen (offload/engine/oop_gen.py; this file is the first one)
! - legality: for the gcc cells: the rules (offload.engine.rules, with the fortran-oop restrictions) and AFAR's flang front end
! (-fsyntax-only) and NVHPC 26.9 nvfortran (compile only) (tools/campaigns/oop.py legality, results/oop/main/legality.json)
module oop_m
implicit none
integer, parameter :: n = 64
type lv(m)
integer, len :: m
integer :: a(m)
end type lv
end module oop_m
program oop
use omp_lib
use oop_m
implicit none
integer :: host_flag
logical :: ok
integer :: r1, r2
type(lv(16)) :: x
integer :: i
host_flag = 1
!$omp target map(from: host_flag)
host_flag = merge(1, 0, omp_is_initial_device())
!$omp end target
do i = 1, 16
x%a(i) = i
end do
!$omp target map(tofrom: x) map(from: r1)
r1 = x%m
do i = 1, x%m
x%a(i) = x%a(i) * x%a(i)
end do
!$omp end target
r2 = sum(x%a)
ok = .true.
ok = ok .and. (r1 == 16)
ok = ok .and. (r2 == 1496)
print '(a,i0)', 'r1= ', r1
print '(a,i0)', 'r2= ', r2
print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
end program oop
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
Failing in Thread:1 Accelerator Fatal Error: call to cuMemcpyDtoHAsync returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution File: <dir> Function: oop:31 Line: 52
What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §5.8.3 p.155 l.5-7
Evidence
Same compiler, one change
- the same program without the target construct (host only): not run yet
Control program
! control for oop-pdt-len: the same program; one change: no target construct (the PDT work runs on the host) ! fortran-oop pdt/len (OpenMP 5.2, free-form Fortran): ! a derived type with a length type parameter (constant), its value read on the device ! spec: OpenMP 5.2 §5.8.3 p.151-155 (map clause); OpenMP 5.2 §5.8.3 p.155 l.5-7 ! legality: defined ! expected (computed by compliance/oop_gen.py): r1= 16, r2= 1496 module oop_m implicit none integer, parameter :: n = 64 type lv(m) integer, len :: m integer :: a(m) end type lv end module oop_m program oop use omp_lib use oop_m implicit none integer :: host_flag logical :: ok integer :: r1, r2 type(lv(16)) :: x integer :: i host_flag = 1 !$omp target map(from: host_flag) host_flag = merge(1, 0, omp_is_initial_device()) !$omp end target do i = 1, 16 x%a(i) = i end do r1 = x%m do i = 1, x%m x%a(i) = x%a(i) * x%a(i) end do r2 = sum(x%a) ok = .true. ok = ok .and. (r1 == 16) ok = ok .and. (r2 == 1496) print '(a,i0)', 'r1= ', r1 print '(a,i0)', 'r2= ', r2 print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok) end program oop