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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (InfiniteVerma)

<details>
<summary>Changes</summary>

Fixes #<!-- -->69200

Issue: Calling function on a nullptr. 

---
Full diff: https://github.com/llvm/llvm-project/pull/77131.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaOpenMP.cpp (+4) 


``````````diff
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;

``````````

</details>


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


More information about the cfe-commits mailing list