Observed issues › gcc/gcc-c-omp60-undocumented-rejected
OpenMP 6.0 requires device_safesync and defaultmap(private) are rejected (not in GCC's implementation status table)
Legality: contested. An independent adjudicating reading finds the result not required: Both readings agree. device_safesync is a member of the requirement clause group in 6.0 and the requires directive is at file scope before any device construct. But support for a requirement clause is implementation defined, and an implementation that does not support it must perform compile-time error termination. The compiler's refusal is therefore permitted. How this is checked
GCC 16.2 rejects two OpenMP 6.0 forms that no row of its implementation status table covers: the device_safesync clause of requires ("expected 'unified_address', 'unified_shared_memory', ...") and defaultmap(private) ("expected 'alloc', 'to', ... before 'private'", the 5.2 list). The other 6.0 rejections are in the finding for the features GCC lists as not implemented.
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 | fails another way | fails another way |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | fails another way | fails another way |
| 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-c-omp60-undocumented-rejected.c:44:22: error: expected ‘unified_address’, ‘unified_shared_memory’, ‘self_maps’, ‘dynamic_allocators’, ‘reverse_offload’ or ‘atomic_default_mem_order’ clau
44 | #pragma omp requires device_safesync
| ^~~~~~~~~~~~~~~ |
| fails another way | AFAR 24.3.0, MI300A unified AFAR 24.3.0, MI300A copy AFAR 24.3.0, MI300X AFAR 24.3.0, MI350X | showsite-gcc--gcc-c-omp60-undocumented-rejected.c:44:22: error: unexpected OpenMP clause 'device_safesync' in directive '#pragma omp requires'
44 | #pragma omp requires device_safesync
| ^
site-gcc--gcc-c-omp60-undocumented-rejected.c:44:22: error: unexpected OpenMP clause 'device_safesync' in directive '#pragma omp requires'
site-gcc--gcc-c-omp60-undocumented-rejected.c:44:22: error: unexpected OpenMP clause 'device_safesync' in directive '#pragma omp requires'
site-gcc--gcc-c-omp60-undocumented-rejected.c:44:22: error: unexpected OpenMP clause 'device_safesync' in directive '#pragma omp requires'
site-gcc--gcc-c-omp60-undocumented-rejected.c:44:22: error: unexpected OpenMP clause 'device_safesync' in directive '#pragma omp requires'
site-gcc--gcc-c-omp60-undocumented-rejected.c:44:22: error: unexpected OpenMP clause 'device_safesync' in directive '#pragma omp requires' |
| fails another way | CCE 19.0.0, MI300A unified CCE 19.0.0, MI300A copy CCE 20.0.2, MI300A unified CCE 20.0.2, MI300A copy CCE 21.0.3, MI300A unified CCE 21.0.3, MI300A copy CCE 21.0.4, MI300A unified CCE 21.0.4, MI300A copy | showsite-gcc--gcc-c-omp60-undocumented-rejected.c:44:22: warning: extra tokens at the end of '#pragma omp requires' are ignored [-Wextra-tokens]
44 | #pragma omp requires device_safesync
| ^
site-gcc--gcc-c-omp60-undocumented-rejected.c:44:37: error: expected at least one clause on '#pragma omp requires' directive
44 | #pragma omp requires device_safesync
| ^
1 warning and 1 error generated. |
| fails another way | NVHPC 25.11, A100 separate NVHPC 25.11, A100 managed NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | show"site-gcc--gcc-c-omp60-undocumented-rejected.c", line 44: error: invalid text in pragma
#pragma omp requires device_safesync
^
"site-gcc--gcc-c-omp60-undocumented-rejected.c", line 44: error: extra text after expected end of preprocessing directive
#pragma omp requires device_safesync
^
2 errors detected in the compilation of "site-gcc--gcc-c-omp60-undocumented-rejected.c". |
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/gcc -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx942 -O2 repro.c -o repro HSA_XNACK=1 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/gcc -fopenmp -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 repro.c -o repro OMP_TARGET_OFFLOAD=mandatory ./repro
Program (70 lines)
// # Finding (GCC 16.2): requires device_safesync and defaultmap(private) are rejected, and GCC's table does not list them (C); the
// reproducer is the catalog program omp60-c-clause-device_safesync
//
// - 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: gcc -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 -O2 (gcc_sm80)
// - failure: rejected
// - observed: `error: expected 'unified_address', 'unified_shared_memory', 'self_maps', 'dynamic_allocators', ...` at
// device_safesync; `error: expected 'alloc', 'to', 'from', 'tofrom', 'firstprivate', 'none' or 'default' before 'private'` at
// defaultmap(private); both GPUs.
// - expected: compiles; `RESULT ran_on_host=0 check=pass`
// - GCC 16.2 documentation (libgomp.texi of the GCC 16.2.0 release tarball, "OpenMP Implementation Status", OpenMP 6.0 table): no
// row names the device_safesync requirement clause or private as a defaultmap implicit-behavior (the table's defaultmap row is
// "self modifier to map and self as defaultmap argument"). Undocumented.
// - spec: the device_safesync clause is a 6.0 requirement clause (6.0 §5.4 p.173 lists it among the clauses that take a
// directive-name modifier); defaultmap's implicit-behavior private is new in 6.0.
// - other families (catalog matrix): requires device_safesync: CCE 19/20/21 and NVHPC reject it; AFAR amdflang compiles and runs
// the Fortran program, AFAR amdclang's C compile does not finish (afar-clang-requires-device-safesync-hang.c).
// defaultmap(private): AFAR amdclang and CCE 21 run the C program correctly, CCE 20 the Fortran one; CCE 19 and NVHPC reject it.
// - gate and confirmer: 8 cells (4 gcc_g90, 4 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):
// unsupported (R11a-newer-form-unclaimed) 8
// - catalog programs (4): omp60-c-clause-defaultmap-private, omp60-c-clause-device_safesync,
// omp60-c-clause-device_safesync-directive_name, omp60-c-clause-device_safesync-required
// - 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.c_gen (OpenMP 6.0, C11): the C port (offload.engine.f2c) of omp60-clause-device_safesync. Do not edit.
// id: omp60-c-clause-device_safesync
// primary atom: omp.clause.device_safesync
// legal: yes
// observable: no (requires only changes semantics: no checked device effect)
// ran_on_host: inside the target region of interest
// evidence: construct
// needs: none
// std: c11
#include <stdio.h>
#include <stdbool.h>
#include <omp.h>
enum { n = 64 };
#pragma omp requires device_safesync
int main(void) {
int a[n];
int b[n];
int ref[n];
int host_flag;
bool ok;
for (int i = 1; i <= n; i++) {
a[i - 1] = i;
b[i - 1] = 0;
ref[i - 1] = 2 * i + 1;
}
host_flag = 1;
#pragma omp target teams distribute parallel for map(to: a) map(from: b) \
map(tofrom: host_flag) default(none) shared(a, b, host_flag)
for (int i = 1; i <= n; i++) {
b[i - 1] = 2 * a[i - 1] + 1;
if (i == 1) host_flag = (omp_is_initial_device() ? 1 : 0);
}
bool t1_ = true;
for (int k2_ = 0; k2_ < n; k2_++)
t1_ = t1_ && (b[k2_] == ref[k2_]);
ok = t1_;
printf("RESULT ran_on_host=%d check=%s\n", host_flag, ok ? "pass" : "fail");
return 0;
}
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-c-omp60-undocumented-rejected.c:44:22: error: expected ‘unified_address’, ‘unified_shared_memory’, ‘self_maps’, ‘dynamic_allocators’, ‘reverse_offload’ or ‘atomic_default_mem_order’ clau
44 | #pragma omp requires device_safesync
| ^~~~~~~~~~~~~~~What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 6.0 §5.4 p.173