Observed issues › catalog/cce21-c-target-loop-ice
Appears to behave incorrectlyCompiler crash · C · OpenMP · Open · regression
craycc: internal compiler error on the 6.0 combined construct target loop instead of a diagnostic
Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked
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 | fails another way | fails another way | fails another way | n/a | n/a |
| CCE 19.0.0 | correct | correct | correct | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | correct | correct | correct | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | behaves incorrectly | behaves incorrectly | behaves incorrectly | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | behaves incorrectly | behaves incorrectly | behaves incorrectly | 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 | fails another way | fails another way | fails another way | fails another way | fails another way | fails another way | 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 | CCE 21.0.3, MI300A unified CCE 21.0.3, MI300A copy CCE 21.0.3, MI250X | showUnknown OpenMP directive
UNREACHABLE executed at /workspace/clang/lib/Sema/SemaOpenMP.cpp:6700!
PLEASE submit a bug report to HPE at https://support.hpe.com/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/cray/pe/cce/21.0.3/cce-clang/x86_64/bin/clang-21 -cc1 -triple x86_64-unknown-linux-gnu -mllvm -cray-omp-opt-fork-call -mllvm -cray-omp-parallel-opt-call -mllvm -cray-openmp-
1. cce21-c-target-loop-ice.c:30:3 <Spelling=/opt/cray/pe/cce/21.0.3/cce-clang/x86_64/lib/clang/21/include/stdbool.h:24:14>: current parser token '_Bool'
2. cce21-c-target-loop-ice.c:9:16: parsing function body 'main'
3. cce21-c-target-loop-ice.c:9:16: in compound statement ('{}') |
| behaves incorrectly | CCE 21.0.4, MI300A unified CCE 21.0.4, MI300A copy CCE 21.0.4, MI250X | showUnknown OpenMP directive
UNREACHABLE executed at /workspace/clang/lib/Sema/SemaOpenMP.cpp:6700!
PLEASE submit a bug report to HPE at https://support.hpe.com/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/cray/pe/cce/21.0.4/cce-clang/x86_64/bin/clang-21 -cc1 -triple x86_64-unknown-linux-gnu -mllvm -cray-omp-opt-fork-call -mllvm -cray-omp-parallel-opt-call -mllvm -cray-openmp-
1. cce21-c-target-loop-ice.c:30:3 <Spelling=/opt/cray/pe/cce/21.0.4/cce-clang/x86_64/lib/clang/21/include/stdbool.h:24:14>: current parser token '_Bool'
2. cce21-c-target-loop-ice.c:9:16: parsing function body 'main'
3. cce21-c-target-loop-ice.c:9:16: in compound statement ('{}') |
| fails another way | AFAR 24.3.0, MI300A unified AFAR 24.3.0, MI300A copy AFAR 24.3.0, MI250X AFAR 24.3.0, MI300X AFAR 24.3.0, MI350X | showcce21-c-target-loop-ice.c:27:3: error: statement after '#pragma omp teams loop' must be a for loop
27 | for (int i = 1; i <= n; i++) {
| ^
1 error generated. |
| fails another way | 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 | showcce21-c-target-loop-ice.c: In function ‘main’:
cce21-c-target-loop-ice.c:26:22: error: expected an OpenMP clause before ‘loop’
26 | #pragma omp target loop map(to: a) map(from: b)
| ^~~~ |
Reproduce
CCE 21.0.3, MI300A unified
module load cce/21.0.3 craype-accel-amd-gfx942 rocm/7.2.0 module unload cray-mpich craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=60 -O2 repro.c -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 craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=60 -O2 repro.c -o repro HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
NVHPC 25.11, A100 separate (runs correctly)
export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib nvc -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.c -o repro OMP_TARGET_OFFLOAD=mandatory ./repro
Program (73 lines)
// # Draft finding: omp60-c-directive-target_loop on cce21
//
// - compiler: cce21
// - toolchain: cce21; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
// - program: catalog omp60-c-directive-target_loop (c, version 60, sha256 f7b09fc0585b20d6)
// - expected: None (None; )
// - actual: ice (ice: PLEASE submit a bug report to HPE at https://support.hpe.com/ and include the crash backtrace, preprocessed source, and associated run script.)
// - verdict: compiler_bug by rule R10-compile-ice: an internal compiler error (or the compiler rejecting code it generated) on a legal program: always the compiler's defect
// - reason:
// - citations: RUL-COMPILE-TIME (rulings.md)
// - legality: legal (legal by construction: offload.engine.gen / c_gen / acc_gen check every program against the catalog rules and the offload scope as it is built (no compiler))
// - witnesses: none
// - withdrawn: none
//
// Generated by compliance.c_gen (OpenMP 6.0, C11): the C port (offload.engine.f2c) of omp60-directive-target_loop. Do not edit.
// id: omp60-c-directive-target_loop
// primary atom: omp.directive.target_loop
// legal: yes
// observable: yes
// ran_on_host: probe (a target region just before the region of interest, which may not call the OpenMP API)
// evidence: construct
// needs: none
// std: c11
#include <stdio.h>
#include <stdbool.h>
#include <omp.h>
enum { n = 64 };
int on_dev = 0;
#pragma omp declare target(on_dev)
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 map(tofrom: host_flag)
{
host_flag = (omp_is_initial_device() ? 1 : 0);
on_dev = 1;
}
#pragma omp target loop map(to: a) map(from: b)
for (int i = 1; i <= n; i++) {
b[i - 1] = 2 * a[i - 1] + on_dev;
}
bool t1_ = true;
for (int k2_ = 0; k2_ < n; k2_++)
t1_ = t1_ && (b[k2_] == 2 * a[k2_]);
if (t1_) host_flag = 1;
bool t3_ = true;
for (int k4_ = 0; k4_ < n; k4_++)
t3_ = t3_ && (b[k4_] == ref[k4_]);
ok = t3_;
printf("RESULT ran_on_host=%d check=%s\n", host_flag, ok ? "pass" : "fail");
return 0;
}
// spec (requirement): OpenMP 6.0 defines target loop as a combined construct, whose semantics are those of a target
// construct holding exactly one loop construct.
// "The semantics of combined constructs are identical to that of explicitly specifying the first construct containing
// one instance of the second construct and no other statements." (6.0 §19.3 p.531 l.2-3)
// spec (requirement): A compound directive name is a combined directive name when the second construct can be
// immediately nested in the first.
// "If the construct named by directive-name-B can be immediately nested inside the construct named by
// directive-name-A, the compound-directive name is a combined-directive name" (6.0 §19.1 p.525 l.11-13)
// spec (this program): target loop is a combined construct of the 6.0 grammar and must behave as target with one loop
// construct; the compiler gives an internal error instead of either compiling it or diagnosing it as unsupported.
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
Unknown OpenMP directive
UNREACHABLE executed at /workspace/clang/lib/Sema/SemaOpenMP.cpp:6700!
PLEASE submit a bug report to HPE at https://support.hpe.com/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/cray/pe/cce/21.0.3/cce-clang/x86_64/bin/clang-21 -cc1 -triple x86_64-unknown-linux-gnu -mllvm -cray-omp-opt-fork-call -mllvm -cray-omp-parallel-opt-call -mllvm -cray-openmp-
1. cce21-c-target-loop-ice.c:30:3 <Spelling=/opt/cray/pe/cce/21.0.3/cce-clang/x86_64/lib/clang/21/include/stdbool.h:24:14>: current parser token '_Bool'
2. cce21-c-target-loop-ice.c:9:16: parsing function body 'main'
3. cce21-c-target-loop-ice.c:9:16: in compound statement ('{}')What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 6.0 §19.3 p.531 l.2-3
The semantics of combined constructs are identical to that of explicitly specifying the first construct containing one instance of the second construct and no other statements.
OpenMP 6.0 §19.1 p.525 l.11-13
If the construct named by directive-name-B can be immediately nested inside the construct named by directive-name-A, the compound-directive name is a combined-directive name
Evidence
Same compiler, one change
- target teams loop instead of target loop: 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
#include <stdio.h> #include <stdbool.h> #include <omp.h> enum { n = 64 }; int on_dev = 0; #pragma omp declare target(on_dev) 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 map(tofrom: host_flag) { host_flag = (omp_is_initial_device() ? 1 : 0); on_dev = 1; } #pragma omp target teams loop map(to: a) map(from: b) for (int i = 1; i <= n; i++) { b[i - 1] = 2 * a[i - 1] + on_dev; } bool t1_ = true; for (int k2_ = 0; k2_ < n; k2_++) t1_ = t1_ && (b[k2_] == 2 * a[k2_]); if (t1_) host_flag = 1; bool t3_ = true; for (int k4_ = 0; k4_ < n; k4_++) t3_ = t3_ && (b[k4_] == ref[k4_]); ok = t3_; printf("RESULT ran_on_host=%d check=%s\n", host_flag, ok ? "pass" : "fail"); return 0; }
Other compilers run it correctly
NVHPC 25.11, NVHPC 26.9