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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu May 22 05:01:04 PDT 2025


================
@@ -14924,6 +14924,21 @@ StmtResult SemaOpenMP::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
   SourceLocation FactorLoc;
   if (Expr *FactorVal = PartialClause->getFactor();
       FactorVal && !FactorVal->containsErrors()) {
+    if (!VerifyPositiveIntegerConstantInClause(FactorVal, OMPC_partial,
----------------
AaronBallman wrote:

One question I have for @alexey-bataev and @shiltian is whether we should hoist the width-checking logic into `VerifyPositiveIntegerConstantInClause()` so that all callers of this function get the same checking instead of just loop unroll directives. Won't all the callers of this function have the same need to diagnose width mismatches? (Apologies for my OpenMP ignorance, maybe I'm wrong.)

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


More information about the cfe-commits mailing list