[clang] [Clang] Prevent null pointer dereferences in SVE tuple functions (PR #94267)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 11 21:00:17 PDT 2024


================
@@ -10211,8 +10211,8 @@ Value *CodeGenFunction::EmitSVETupleSetOrGet(const SVETypeFlags &TypeFlags,
          "Expects TypleFlag isTupleSet or TypeFlags.isTupleSet()");
 
   unsigned I = cast<ConstantInt>(Ops[1])->getSExtValue();
-  auto *SingleVecTy = dyn_cast<llvm::ScalableVectorType>(
-                      TypeFlags.isTupleSet() ? Ops[2]->getType() : Ty);
+  auto *SingleVecTy = cast<llvm::ScalableVectorType>(
----------------
smanna12 wrote:

Thank you @CarolineConcatto for reviews. I have updated patch. Could you please review again? 

>>Is it possible to add a test for this change too?

The issues are reported by Static Analyzer tool, I am not sure how we can add a test here to verify the fix.

@tahonermann, any opinion? 


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


More information about the cfe-commits mailing list