Clang error: expected... variable of type 'omp_interop_t' (err_omp_interop_variable_expected)
Jump to navigation
Jump to search
Text |
(since 13.0) | ||||||
---|---|---|---|---|---|---|---|
Type | Error | ||||||
Category | OpenMP Issue (since 13.0) | ||||||
Internal Id | err_omp_interop_variable_expected (since 13.0) | ||||||
Internal Message | expected%select{| non-const}0 variable of type 'omp_interop_t' (since 13.0)
| ||||||
Regular Expression | (?:error|fatal error)\: expected(?:| non\-const) variable of type 'omp_interop_t'
| ||||||
First Commit | 2020-05-20 61d065e21ff3 Let clang atomic builtins fetch add/sub support floating point types |
Description
Example
Flags | -fopenmp -xc
|
|
---|---|---|
Source |
#include <omp.h>
int main() {
omp_interop_t i = 0; // Initialization not according to omp_interop_t requirements
const omp_interop_t c = i; // Constant type not allowed with interop
#pragma omp interop init(targetsync: c) // const variable used here
}
| |
Compiler Output |
<source>:7:40: error: expected non-const variable of type 'omp_interop_t' <source>:7:3: error: expected at least one 'init', 'use', 'destroy', or 'nowait' clause for '#pragma omp interop' |
Clang Internals (17.0.6)
Git Commit Message
Let clang atomic builtins fetch add/sub support floating point types Recently atomicrmw started to support fadd/fsub: https://reviews.llvm.org/D53965 However clang atomic builtins fetch add/sub still does not support emitting atomicrmw fadd/fsub. This patch adds that. Reviewed by: John McCall, Artem Belevich, Matt Arsenault, JF Bastien, James Y Knight, Louis Dionne, Olivier Giroux Differential Revision: https://reviews.llvm.org/D71726
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 17685)
static bool isValidInteropVariable(Sema &SemaRef, Expr *InteropVarExpr, SourceLocation VarLoc, OpenMPClauseKind Kind) {
// ...
// OpenMP 5.1 [2.15.1, interop Construct, Restrictions]
// The interop-var passed to init or destroy must be non-const.
if ((Kind == OMPC_init || Kind == OMPC_destroy) && isConstNotMutableType(SemaRef, InteropVarExpr->getType())) {
SemaRef.Diag(VarLoc, diag::err_omp_interop_variable_expected) << /*non-const*/ 1;
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/OpenMP/interop_messages.cpp
- clang/test/OpenMP/interop_messages.cpp:197:50: error: expected variable of type 'omp_interop_t'
- clang/test/OpenMP/interop_messages.cpp:200:52: error: expected variable of type 'omp_interop_t'