[llvm] [NSan] Fix null-pointer crash on unsupported vector element sizes (PR #202270)
Maosu Zhao via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 22:46:21 PDT 2026
https://github.com/zhaomaosu updated https://github.com/llvm/llvm-project/pull/202270
>From 397c15209aac8b1fcdb3e078f4a31d58ceae77d9 Mon Sep 17 00:00:00 2001
From: Maosu Zhao <maosu.zhao at intel.com>
Date: Wed, 3 Jun 2026 15:46:59 +0800
Subject: [PATCH] [NSan] Fix null-pointer crash on unsupported vector element
sizes
In propagateNonFTStore, BitcastTy is left null when a ConstantDataVector
has an element width other than 32/64/80 bits (e.g., f16, bf16, fp128).
Passing a null element type into VectorType::get crashes. Guard the
VectorType::get call so the unsupported case falls through to the
"reset shadow to unknown" path.
---
.../Instrumentation/NumericalStabilitySanitizer.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
index f40816d07d566..de2854d79277e 100644
--- a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
@@ -1897,8 +1897,9 @@ void NumericalStabilitySanitizer::propagateNonFTStore(
break;
}
- if (auto *VectorTy = dyn_cast<VectorType>(C->getType()))
- BitcastTy = VectorType::get(BitcastTy, VectorTy->getElementCount());
+ if (BitcastTy)
+ if (auto *VectorTy = dyn_cast<VectorType>(C->getType()))
+ BitcastTy = VectorType::get(BitcastTy, VectorTy->getElementCount());
}
if (BitcastTy) {
const MemoryExtents Extents = getMemoryExtentsOrDie(BitcastTy);
More information about the llvm-commits
mailing list