[PATCH] D86858: [OpenMP] Fix infinite loop in Sema::isOpenMPGlobalCapturedDecl()
Yang Fan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 30 21:33:34 PDT 2020
nullptr.cpp created this revision.
nullptr.cpp added a reviewer: ABataev.
Herald added subscribers: cfe-commits, danielkiss, guansong, yaxunl.
Herald added a project: clang.
nullptr.cpp requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Function Sema::isOpenMPGlobalCapturedDecl() has a parameter `unsigned Level`,
but use `Level >= 0` as the condition of `while`, thus cause an infinite loop.
Fix by changing the type of `Level` to `int`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86858
Files:
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaOpenMP.cpp
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -2410,7 +2410,7 @@
Regions[CaptureLevel] != OMPD_task;
}
-bool Sema::isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
+bool Sema::isOpenMPGlobalCapturedDecl(ValueDecl *D, int Level,
unsigned CaptureLevel) const {
assert(LangOpts.OpenMP && "OpenMP is not allowed");
// Return true if the current level is no longer enclosed in a target region.
Index: clang/include/clang/Sema/Sema.h
===================================================================
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -10114,7 +10114,7 @@
/// regions.
/// \param Level Relative level of nested OpenMP construct for that
/// the check is performed.
- bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
+ bool isOpenMPGlobalCapturedDecl(ValueDecl *D, int Level,
unsigned CaptureLevel) const;
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86858.288888.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200831/f8e77d62/attachment-0001.bin>
More information about the cfe-commits
mailing list