[llvm] [NSan] Fix null-pointer crash on unsupported vector element sizes (PR #202270)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 7 23:52:11 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Maosu Zhao (zhaomaosu)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/202270.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp (+3-2)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/202270
More information about the llvm-commits
mailing list