[clang] [Clang][OpenMP] Fix crash on a function name used as an integer clause argument (PR #228864)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 4 05:17:07 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Akash Manna (akash-manna-sky)
<details>
<summary>Changes</summary>
Fixes #<!-- -->140257
`PerformContextualImplicitConversion` diagnosed an expression it couldn't convert, but then returned that same expression as a valid result. The OpenMP clause code took that as success and kept going with the unconverted expression. In C, `device(omp_is_initial_device)` (a missing `()`) ended up captured in a variable of function type with no initializer, and we crashed on that null initializer at the end of the region. `num_threads`, `schedule`, `linear` and the other clauses that share the conversion crashed the same way.
It now returns `ExprError()` on every path where it reports that no conversion exists. The OpenMP callers already handle an invalid result, so the clause is just dropped after the diagnostic. The other callers were rejecting a non-matching result on their own, so nothing changes for them, and the two re-checks whose `FIXMEs` asked for this are removed along with the `sizes` workaround. Two visible side effects: a clause argument of the wrong type that doesn't depend on a template parameter is diagnosed once instead of once more per instantiation, and array sections and array shaping now also emit their existing "is not an integer" error.
---
Patch is 40.42 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/228864.diff
43 Files Affected:
- (modified) clang/docs/ReleaseNotes.md (+2)
- (modified) clang/lib/Sema/SemaExprCXX.cpp (-4)
- (modified) clang/lib/Sema/SemaOpenMP.cpp (-6)
- (modified) clang/lib/Sema/SemaOverload.cpp (+9-6)
- (modified) clang/lib/Sema/SemaStmt.cpp (+1-8)
- (modified) clang/test/OpenMP/distribute_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/distribute_parallel_for_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/distribute_simd_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/parallel_num_threads_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_data_messages.c (+16)
- (modified) clang/test/OpenMP/target_device_messages.cpp (+4)
- (modified) clang/test/OpenMP/target_parallel_for_misc_messages.c (+21)
- (modified) clang/test/OpenMP/target_parallel_num_threads_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_thread_limit_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_thread_limit_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_thread_limit_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_teams_thread_limit_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/target_update_device_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_num_teams_messages_attr.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_thread_limit_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_thread_limit_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_simd_dist_schedule_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_simd_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_simd_thread_limit_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_distribute_thread_limit_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_num_teams_messages.cpp (+1-1)
- (modified) clang/test/OpenMP/teams_thread_limit_messages.cpp (+1-1)
``````````diff
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index bf194e87f76a6..371447920354b 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -1102,6 +1102,8 @@ The `alpha.cplusplus.UseAfterLifetimeEnd` checker was renamed to `alpha.core.Use
- The `holds` clause on the `assume` directive now lowers side-effect-free
conditions to `llvm.assume`, enabling downstream optimizations. Previously
the clause was parsed but its condition was discarded without effect.
+- Fixed a crash in C when a function name is used as the argument of an OpenMP
+ clause that requires an integer expression, such as `device`. (#GH140257)
- Fixed a crash when the loop variable or a loop bound of an OpenMP loop has a
`_BitInt` type wider than any standard integer type. (#GH140074)
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index b89c97f2b8900..dabbf72b17ce1 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -4196,10 +4196,6 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
if (Ex.isInvalid())
return ExprError();
Type = Ex.get()->getType();
- if (!Converter.match(Type))
- // FIXME: PerformContextualImplicitConversion should return ExprError
- // itself in this case.
- return ExprError();
QualType Pointee = Type->castAs<PointerType>()->getPointeeType();
QualType PointeeElem = Context.getBaseElementType(Pointee);
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index efc570a8933f1..410a679f4635e 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -19373,12 +19373,6 @@ OMPClause *SemaOpenMP::ActOnOpenMPSizesClause(ArrayRef<Expr *> SizeExprs,
bool IsValid = isNonNegativeIntegerValue(SizeExpr, SemaRef, OMPC_sizes,
/*StrictlyPositive=*/true);
- // isNonNegativeIntegerValue returns true for non-integral types (but still
- // emits error diagnostic), so check for the expected type explicitly.
- QualType SizeTy = SizeExpr->getType();
- if (!SizeTy->isIntegerType())
- IsValid = false;
-
// Handling in templates is tricky. There are four possibilities to
// consider:
//
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index cd1bd2cecc490..9e8e24e488416 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -6986,7 +6986,7 @@ diagnoseAmbiguousConversion(Sema &SemaRef, SourceLocation Loc, Expr *From,
QualType ConvTy = Conv->getConversionType().getNonReferenceType();
Converter.noteAmbiguous(SemaRef, Conv, ConvTy);
}
- return From;
+ return ExprError();
}
static bool
@@ -7066,9 +7066,12 @@ static bool recordConversion(Sema &SemaRef, SourceLocation Loc, Expr *&From,
static ExprResult finishContextualImplicitConversion(
Sema &SemaRef, SourceLocation Loc, Expr *From,
Sema::ContextualImplicitConverter &Converter) {
- if (!Converter.match(From->getType()) && !Converter.Suppress)
- Converter.diagnoseNoMatch(SemaRef, Loc, From->getType())
- << From->getSourceRange();
+ if (!Converter.match(From->getType())) {
+ if (!Converter.Suppress)
+ Converter.diagnoseNoMatch(SemaRef, Loc, From->getType())
+ << From->getSourceRange();
+ return ExprError();
+ }
return SemaRef.DefaultLvalueConversion(From);
}
@@ -7144,7 +7147,7 @@ ExprResult Sema::PerformContextualImplicitConversion(
if (!RecordTy || !getLangOpts().CPlusPlus) {
if (!Converter.Suppress)
Converter.diagnoseNoMatch(*this, Loc, T) << From->getSourceRange();
- return From;
+ return ExprError();
}
// We must have a complete class type.
@@ -7162,7 +7165,7 @@ ExprResult Sema::PerformContextualImplicitConversion(
if (Converter.Suppress ? !isCompleteType(Loc, T)
: RequireCompleteType(Loc, T, IncompleteDiagnoser))
- return From;
+ return ExprError();
// Look for a conversion to an integral or enumeration type.
UnresolvedSet<4>
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 25db6087d8d25..903ec39cc5c17 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1184,15 +1184,8 @@ ExprResult Sema::CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond) {
if (CondResult.isInvalid())
return ExprError();
- // FIXME: PerformContextualImplicitConversion doesn't always tell us if it
- // failed and produced a diagnostic.
- Cond = CondResult.get();
- if (!Cond->isTypeDependent() &&
- !Cond->getType()->isIntegralOrEnumerationType())
- return ExprError();
-
// C99 6.8.4.2p5 - Integer promotions are performed on the controlling expr.
- return UsualUnaryConversions(Cond);
+ return UsualUnaryConversions(CondResult.get());
}
StmtResult Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
diff --git a/clang/test/OpenMP/distribute_dist_schedule_messages.cpp b/clang/test/OpenMP/distribute_dist_schedule_messages.cpp
index cd232f40feb43..15ff00ba3bf3f 100644
--- a/clang/test/OpenMP/distribute_dist_schedule_messages.cpp
+++ b/clang/test/OpenMP/distribute_dist_schedule_messages.cpp
@@ -35,7 +35,7 @@ T tmain(T argc) {
for (int i = 0; i < 10; ++i) foo();
#pragma omp distribute dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 0; i < 10; ++i) foo();
- #pragma omp distribute dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
+ #pragma omp distribute dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
for (int i = 0; i < 10; ++i) foo();
return T();
}
diff --git a/clang/test/OpenMP/distribute_parallel_for_dist_schedule_messages.cpp b/clang/test/OpenMP/distribute_parallel_for_dist_schedule_messages.cpp
index 07e7704dffded..fe9e4d993bf0c 100644
--- a/clang/test/OpenMP/distribute_parallel_for_dist_schedule_messages.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_dist_schedule_messages.cpp
@@ -54,7 +54,7 @@ T tmain(T argc) {
for (int i = 0; i < 10; ++i) foo();
#pragma omp target
#pragma omp teams
-#pragma omp distribute parallel for dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
+#pragma omp distribute parallel for dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
for (int i = 0; i < 10; ++i) foo();
return T();
}
diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_dist_schedule_messages.cpp b/clang/test/OpenMP/distribute_parallel_for_simd_dist_schedule_messages.cpp
index ed7b19111dee8..7d4a41030fbd8 100644
--- a/clang/test/OpenMP/distribute_parallel_for_simd_dist_schedule_messages.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_simd_dist_schedule_messages.cpp
@@ -55,7 +55,7 @@ T tmain(T argc) {
for (int i = 0; i < 10; ++i) foo();
#pragma omp target
#pragma omp teams
-#pragma omp distribute parallel for simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
+#pragma omp distribute parallel for simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
for (int i = 0; i < 10; ++i) foo();
return T();
}
diff --git a/clang/test/OpenMP/distribute_simd_dist_schedule_messages.cpp b/clang/test/OpenMP/distribute_simd_dist_schedule_messages.cpp
index 794681c02646c..87fded6e65250 100644
--- a/clang/test/OpenMP/distribute_simd_dist_schedule_messages.cpp
+++ b/clang/test/OpenMP/distribute_simd_dist_schedule_messages.cpp
@@ -63,7 +63,7 @@ T tmain(T argc) {
for (int i = 0; i < 10; ++i) foo();
#pragma omp target
#pragma omp teams
-#pragma omp distribute simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
+#pragma omp distribute simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
for (int i = 0; i < 10; ++i) foo();
return T();
}
diff --git a/clang/test/OpenMP/parallel_num_threads_messages.cpp b/clang/test/OpenMP/parallel_num_threads_messages.cpp
index fbffa06c29d6d..2637fa5353ec9 100644
--- a/clang/test/OpenMP/parallel_num_threads_messages.cpp
+++ b/clang/test/OpenMP/parallel_num_threads_messages.cpp
@@ -42,7 +42,7 @@ T tmain(T argc, S **argv) {
#pragma omp parallel num_threads(strict: // omp60-error {{expected expression}} omp60-error {{expected ')'}} omp60-note {{to match this '('}}
// Invalid: unknown/missing modifier
- #pragma omp parallel num_threads(foo: 4) // omp60-error {{expected ',' or ')' in 'num_threads' clause}} omp60-error {{expected ')'}} omp60-note {{to match this '('}} omp60-error 3 {{expression must have integral or unscoped enumeration type, not 'void ()'}}
+ #pragma omp parallel num_threads(foo: 4) // omp60-error {{expected ',' or ')' in 'num_threads' clause}} omp60-error {{expected ')'}} omp60-note {{to match this '('}} omp60-error {{expression must have integral or unscoped enumeration type, not 'void ()'}}
#pragma omp parallel num_threads(: 4) // omp60-error {{expected expression}}
#pragma omp parallel num_threads(:)// omp60-error {{expected expression}}
diff --git a/clang/test/OpenMP/target_data_messages.c b/clang/test/OpenMP/target_data_messages.c
index bb56629a33663..52a2d283d5bc7 100644
--- a/clang/test/OpenMP/target_data_messages.c
+++ b/clang/test/OpenMP/target_data_messages.c
@@ -54,3 +54,19 @@ int main(int argc, char **argv) {
{}
return 0;
}
+
+extern int omp_is_initial_device(void);
+
+void gh140257(void) {
+ int i = 0, a[2];
+ #pragma omp target device(omp_is_initial_device) // expected-error {{expression must have integral or unscoped enumeration type, not 'int (void)'}}
+ i++;
+ #pragma omp target data map(i) device(omp_is_initial_device) // expected-error {{expression must have integral or unscoped enumeration type, not 'int (void)'}}
+ i++;
+ #pragma omp target map(a[omp_is_initial_device:1]) // expected-error {{expression must have integral or unscoped enumeration type, not 'int (void)'}} expected-error {{array section lower bound is not an integer}}
+ i++;
+ #pragma omp target device(omp_is_initial_device())
+ i++;
+ #pragma omp target device(1)
+ i++;
+}
diff --git a/clang/test/OpenMP/target_device_messages.cpp b/clang/test/OpenMP/target_device_messages.cpp
index a58ba2bcaee6c..e0e9803b3b3aa 100644
--- a/clang/test/OpenMP/target_device_messages.cpp
+++ b/clang/test/OpenMP/target_device_messages.cpp
@@ -45,6 +45,10 @@ int main(int argc, char **argv) {
foo();
#pragma omp target device (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}
foo();
+ #pragma omp target device (foobool) // expected-error {{expression must have integral or unscoped enumeration type, not 'bool (int)'}}
+ foo();
+ #pragma omp target device (foobool(argc))
+ foo();
#pragma omp target device (ancestor) // expected-error {{use of undeclared identifier 'ancestor'}}
foo();
diff --git a/clang/test/OpenMP/target_parallel_for_misc_messages.c b/clang/test/OpenMP/target_parallel_for_misc_messages.c
index d225a1e93d53e..92588d81da3cf 100644
--- a/clang/test/OpenMP/target_parallel_for_misc_messages.c
+++ b/clang/test/OpenMP/target_parallel_for_misc_messages.c
@@ -314,3 +314,24 @@ void test_loop_messages(void) {
}
}
+extern int omp_is_initial_device(void);
+
+void test_gh140257(void) {
+ int i, k = 0;
+// expected-error at +1 {{expression must have integral or unscoped enumeration type, not 'int (void)'}}
+#pragma omp target parallel for num_threads(omp_is_initial_device)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +1 {{expression must have integral or unscoped enumeration type, not 'int (void)'}}
+#pragma omp target parallel for schedule(static, omp_is_initial_device)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +1 {{expression must have integral or unscoped enumeration type, not 'int (void)'}}
+#pragma omp target parallel for linear(k : omp_is_initial_device)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target parallel for num_threads(omp_is_initial_device())
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/target_parallel_num_threads_messages.cpp b/clang/test/OpenMP/target_parallel_num_threads_messages.cpp
index 19d40a3448cef..532b3a46446df 100644
--- a/clang/test/OpenMP/target_parallel_num_threads_messages.cpp
+++ b/clang/test/OpenMP/target_parallel_num_threads_messages.cpp
@@ -59,7 +59,7 @@ T tmain(T argc, S **argv) {
foo();
// Invalid: unknown/missing modifier
- #pragma omp target parallel num_threads(foo: 4) // omp60-error {{expected ',' or ')' in 'num_threads' clause}} omp60-error {{expected ')'}} omp60-note {{to match this '('}} omp60-error 3 {{expression must have integral or unscoped enumeration type, not 'void ()'}}
+ #pragma omp target parallel num_threads(foo: 4) // omp60-error {{expected ',' or ')' in 'num_threads' clause}} omp60-error {{expected ')'}} omp60-note {{to match this '('}} omp60-error {{expression must have integral or unscoped enumeration type, not 'void ()'}}
foo();
#pragma omp target parallel num_threads(: 4) // omp60-error {{expected expression}}
foo();
diff --git a/clang/test/OpenMP/target_teams_distribute_dist_schedule_messages.cpp b/clang/test/OpenMP/target_teams_distribute_dist_schedule_messages.cpp
index 69c1e55eeaa3b..42cae3a5601e3 100644
--- a/clang/test/OpenMP/target_teams_distribute_dist_schedule_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_dist_schedule_messages.cpp
@@ -45,7 +45,7 @@ T tmain(T argc) {
#pragma omp target teams distribute dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 0; i < 10; ++i) foo();
-#pragma omp target teams distribute dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
+#pragma omp target teams distribute dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
for (int i = 0; i < 10; ++i) foo();
return T();
diff --git a/clang/test/OpenMP/target_teams_distribute_num_teams_messages.cpp b/clang/test/OpenMP/target_teams_distribute_num_teams_messages.cpp
index 0fc2f3ff54017..40cec9333f6ab 100644
--- a/clang/test/OpenMP/target_teams_distribute_num_teams_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_num_teams_messages.cpp
@@ -41,7 +41,7 @@ T tmain(T argc) {
for (int i=0; i<100; i++) foo();
#pragma omp target teams distribute num_teams(-10u)
for (int i=0; i<100; i++) foo();
-#pragma omp target teams distribute num_teams(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}}
+#pragma omp target teams distribute num_teams(3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}
for (int i=0; i<100; i++) foo();
#pragma omp target teams distribute num_teams(1, 2, 3) // expected-error {{unexpected number of expressions in 'num_teams' clause (expected 1, have 3)}}
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_messages.cpp
index a0efad18668e9..d0511644f7446 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_messages.cpp
@@ -45,7 +45,7 @@ T tmain(T argc) {
#pragma omp target teams distribute parallel for dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 0; i < 10; ++i) foo();
-#pragma omp target teams distribute parallel for dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
+#pragma omp target teams distribute parallel for dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
for (int i = 0; i < 10; ++i) foo();
return T();
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_num_teams_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_num_teams_messages.cpp
index 4d72a2c23bb28..39c3a4edc6941 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_num_teams_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_num_teams_messages.cpp
@@ -41,7 +41,7 @@ T tmain(T argc) {
for (int i=0; i<100; i++) foo();
#pragma omp target teams distribute parallel for num_teams(-10u)
for (int i=0; i<100; i++) foo();
-#pragma omp target teams distribute parallel for num_teams(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}}
+#pragma omp target teams distribute parallel for num_teams(3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}
for (int i=0; i<100; i++) foo();
#pragma omp target teams distribute parallel for num_teams(1, 2, 3) // expected-error {{unexpected number of expressions in 'num_teams' clause (expected 1, have 3)}}
for (int i=0; i<100; i++) foo();
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_messages.cpp
index ec634c8ac01c9..febfd37fe0e7e 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_messages.cpp
@@ -45,7 +45,7 @@ T tmain(T argc) {
#pragma omp target teams distribute parallel for simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 0; i < 10; ++i) foo();
-#pragma omp target teams distribute parallel for simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
+#pragma omp target teams distribute parallel for simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
for (int i = 0; i < 10; ++i) foo();
return T();
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_num_teams_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_num_teams_messages.cpp
index 8d611f76ed5ad..b7e78a8aab1b5 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_num_teams_messages.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_num_teams_messages.cpp
@@ -41,7 +41,7 @@ T tmain(T argc) {
for (int i=0; i<100; i++) foo();
#pragma omp target teams distribute parallel for simd num_teams(-10u)
for (int i=0; i<100; i++) foo();
-#pragma omp target teams distribute parallel for simd num_teams(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}}
+#pragma omp target teams distribute parallel for simd num_teams(3.14) // expected-er...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/228864
More information about the cfe-commits
mailing list