Clang error: OpenMP constructs may not be nested inside a simd region... (err_omp_prohibited_region_simd)
Jump to navigation
Jump to search
Text |
(since 11.0)
(10.0) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Type | Error | ||||||||||
Category | OpenMP Issue | ||||||||||
Internal Id | err_omp_prohibited_region_simd | ||||||||||
Internal Message | OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0 (since 11.0)OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd or atomic directive}0 (10.0)OpenMP constructs may not be nested inside a simd region (until 9.0)
| ||||||||||
Regular Expression | (?:error|fatal error)\: OpenMP constructs may not be nested inside a simd region(?:| except for ordered simd, simd, scan, or atomic directive)
| ||||||||||
First Commit | 2014-06-24 549210e783c7 [OPENMP] Added initial checking of nesting of OpenMP regions. |
Description
Example
Flags | -xc++ -fopenmp
|
|
---|---|---|
Source |
#include <omp.h>
int main() {
#pragma omp parallel
{
#pragma omp single
{
#pragma omp task depend(inout: omp_get_thread_num())
}
}
#pragma omp for simd
for(int i = 0; i < 10; ++i) {
#pragma omp taskloop simd
for(int j = 0; j < 10; ++j) {
}
}
return 0;
}
| |
Compiler Output |
<source>:7:38: error: expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type <source>:8:5: error: expected statement <source>:12:5: error: OpenMP constructs may not be nested inside a simd region except for ordered simd, simd, scan, or atomic directive |
Clang Internals (17.0.6)
Git Commit Message
[OPENMP] Added initial checking of nesting of OpenMP regions. llvm-svn: 211566
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaOpenMP.cpp (line 5009)
static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack, OpenMPDirectiveKind CurrentRegion, const DeclarationNameInfo &CurrentName, OpenMPDirectiveKind CancelRegion, OpenMPBindClauseKind BindKind, SourceLocation StartLoc) {
if (Stack->getCurScope()) {
// ...
if (isOpenMPSimdDirective(ParentRegion) && ((SemaRef.LangOpts.OpenMP <= 45 && CurrentRegion != OMPD_ordered) || (SemaRef.LangOpts.OpenMP >= 50 && CurrentRegion != OMPD_ordered && CurrentRegion != OMPD_simd && CurrentRegion != OMPD_atomic && CurrentRegion != OMPD_scan))) {
// ...
SemaRef.Diag(StartLoc, (CurrentRegion != OMPD_simd) ? diag::err_omp_prohibited_region_simd : diag::warn_omp_nesting_simd) << (SemaRef.LangOpts.OpenMP >= 50 ? 1 : 0);
clang/lib/Sema/SemaOpenMP.cpp (line 11361)
StmtResult Sema::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc) {
// ...
if (!ErrorFound && !SC && isOpenMPSimdDirective(DSAStack->getParentDirective())) {
// ...
Diag(StartLoc, diag::err_omp_prohibited_region_simd) << (LangOpts.OpenMP >= 50 ? 1 : 0);
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c
- clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c:172:1: error: OpenMP constructs may not be nested inside a simd region except for ordered simd, simd, scan, or atomic directive