Skip to content

Commit afeb2a5

Browse files
committed
Changed the Factor variable and Iterator Variable
1 parent cd13fc4 commit afeb2a5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14986,12 +14986,13 @@ StmtResult SemaOpenMP::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
1498614986
.isUsable()) {
1498714987
return StmtError();
1498814988
}
14989-
// Checking if Itertor Variable Type can hold the Factor Width
14990-
if (FactorVal->getIntegerConstantExpr(Context)->getBitWidth() >
14991-
Context.getTypeSize(IVTy)) {
14989+
// Checking if Iterator Variable Type can hold the Factor Width
14990+
auto FactorValWidth = FactorVal->getIntegerConstantExpr(Context)->getActiveBits();
14991+
auto IteratorVWidth = Context.getTypeSize(OrigVar->getType());
14992+
if ( FactorValWidth > IteratorVWidth ) {
1499214993
Diag(FactorVal->getExprLoc(), diag::err_omp_unroll_factor_width_mismatch)
14993-
<< FactorVal->getIntegerConstantExpr(Context)->getBitWidth() << IVTy
14994-
<< Context.getTypeSize(IVTy);
14994+
<< FactorValWidth << OrigVar->getType()
14995+
<< IteratorVWidth;
1499514996
return StmtError();
1499614997
}
1499714998

0 commit comments

Comments
 (0)