[clang] [OpenMP] Add diagnostic for 'factor' width mismatch in 'unroll partial' (PR #139986)

Shilei Tian via cfe-commits cfe-commits at lists.llvm.org
Thu May 15 06:53:41 PDT 2025


================
@@ -14924,8 +14924,25 @@ StmtResult SemaOpenMP::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
   SourceLocation FactorLoc;
   if (Expr *FactorVal = PartialClause->getFactor();
       FactorVal && !FactorVal->containsErrors()) {
+    if (!VerifyPositiveIntegerConstantInClause(FactorVal, OMPC_partial,
+                                               /*StrictlyPositive=*/true,
+                                               /*SuppressExprDiags=*/false)
+             .isUsable()) {
+      return StmtError();
+    }
----------------
shiltian wrote:

```suggestion
             .isUsable())
      return StmtError();
```

https://github.com/llvm/llvm-project/pull/139986


More information about the cfe-commits mailing list