[clang] [clang] Fix static analyzer concerns (PR #110243)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 27 04:04:15 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Mariya Podchishchaeva (Fznamznon)
<details>
<summary>Changes</summary>
It seems in checkOpenMPIterationSpace `OrderedLoopCountExpr` can also be null, so check before dereferencing.
---
Full diff: https://github.com/llvm/llvm-project/pull/110243.diff
1 Files Affected:
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+1-1)
``````````diff
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 9afb8cea26fe78..8615da4b044a82 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -9195,7 +9195,7 @@ static bool checkOpenMPIterationSpace(
SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
diag::note_omp_collapse_ordered_expr)
<< 0 << CollapseLoopCountExpr->getSourceRange();
- else
+ else if (OrderedLoopCountExpr)
SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
diag::note_omp_collapse_ordered_expr)
<< 1 << OrderedLoopCountExpr->getSourceRange();
``````````
</details>
https://github.com/llvm/llvm-project/pull/110243
More information about the cfe-commits
mailing list