[clang] [clang] Fix static analyzer concerns (PR #110243)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 00:26:44 PDT 2024


https://github.com/Fznamznon updated https://github.com/llvm/llvm-project/pull/110243

>From 314a8f4d4f8e003881bed0c320f9ee80ba0b8f8c Mon Sep 17 00:00:00 2001
From: "Podchishchaeva, Mariya" <mariya.podchishchaeva at intel.com>
Date: Fri, 27 Sep 2024 04:00:31 -0700
Subject: [PATCH] [clang] Fix static analyzer concerns

It seems in checkOpenMPIterationSpace `OrderedLoopCountExpr` can also be
null, so check before dereferencing.
---
 clang/lib/Sema/SemaOpenMP.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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();



More information about the cfe-commits mailing list