Clang error: region cannot be... nested inside 'B' region... (err_omp_prohibited_region)
Jump to navigation
Jump to search
Text |
(since 11.0)
(until 10.0) | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Type | Error | |||||||||||||||||||||||||
Category | OpenMP Issue | |||||||||||||||||||||||||
Internal Id | err_omp_prohibited_region | |||||||||||||||||||||||||
Internal Message | region cannot be%select{| closely}0 nested inside '%1' region%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|; perhaps you forget to enclose 'omp %3' directive into a target region?|; perhaps you forget to enclose 'omp %3' directive into a teams region?|; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2 (since 11.0)region cannot be%select{| closely}0 nested inside '%1' region%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|; perhaps you forget to enclose 'omp %3' directive into a target region?|; perhaps you forget to enclose 'omp %3' directive into a teams region?}2 (until 10.0)
| |||||||||||||||||||||||||
Regular Expression | (?:error|fatal error)\: region cannot be(?:| closely) nested inside '(.*?)' region(?:|; perhaps you forget to enclose 'omp (.*?)' directive into a parallel region\?|; perhaps you forget to enclose 'omp (.*?)' directive into a for or a parallel for region with 'ordered' clause\?|; perhaps you forget to enclose 'omp (.*?)' directive into a target region\?|; perhaps you forget to enclose 'omp (.*?)' directive into a teams region\?|; perhaps you forget to enclose 'omp (.*?)' directive into a for, simd, for simd, parallel for, or parallel for simd region\?)
| |||||||||||||||||||||||||
First Commit | 2014-06-24 549210e783c7 [OPENMP] Added initial checking of nesting of OpenMP regions. |
Description
Example
Flags | -fopenmp -xc
|
|
---|---|---|
Source |
#include <omp.h>
int main() {
#pragma omp parallel
#pragma omp for
for(int i = 0; i < 10; i++) {
#pragma omp ordered
;
}
return 0;
}
| |
Compiler Output |
<source>:6:1: error: region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause? |
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 5237)
static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack, OpenMPDirectiveKind CurrentRegion, const DeclarationNameInfo &CurrentName, OpenMPDirectiveKind CancelRegion, OpenMPBindClauseKind BindKind, SourceLocation StartLoc) {
if (Stack->getCurScope()) {
// ...
if (NestingProhibited) {
if (OrphanSeen) {
// ...
} else {
SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region) << CloseNesting << getOpenMPDirectiveName(OffendingRegion) << Recommend << getOpenMPDirectiveName(CurrentRegion);
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/OpenMP/target_teams_generic_loop_messages.cpp
- clang/test/OpenMP/target_teams_generic_loop_messages.cpp:21:5: error: region cannot be closely nested inside 'target teams loop' region
- clang/test/OpenMP/target_teams_generic_loop_messages.cpp:30:5: error: region cannot be closely nested inside 'target teams loop' region
- clang/test/OpenMP/target_teams_generic_loop_messages.cpp:41:5: error: region cannot be closely nested inside 'target teams loop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?
- clang/test/OpenMP/target_teams_generic_loop_messages.cpp:48:5: error: region cannot be closely nested inside 'target teams loop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?
- clang/test/OpenMP/target_teams_generic_loop_messages.cpp:55:5: error: region cannot be closely nested inside 'target teams loop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?