[clang] [Clang] Add a NULL check (PR #77131)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 11:47:45 PST 2024


https://github.com/InfiniteVerma created https://github.com/llvm/llvm-project/pull/77131

Fixes #69200

Issue: Calling function on a nullptr. 

>From 86a898c55eb304705b7bd0e224b746c7a9284ed0 Mon Sep 17 00:00:00 2001
From: InfiniteVerma <vermainfinite at gmail.com>
Date: Sat, 6 Jan 2024 00:42:34 +0530
Subject: [PATCH] [Clang] Add a NULL check

Fixes #69200
---
 clang/lib/Sema/SemaOpenMP.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index f34d2959dc6191..851fa10b6b0515 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -21067,6 +21067,10 @@ Sema::ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data,
               ExprTy = ATy->getElementType();
             else
               ExprTy = BaseType->getPointeeType();
+            // bug 69200
+            if(ExprTy.isNull()) {
+                continue;
+            }
             ExprTy = ExprTy.getNonReferenceType();
             const Expr *Length = OASE->getLength();
             Expr::EvalResult Result;



More information about the cfe-commits mailing list