aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-08-01 21:18:18 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-08-01 21:18:18 +0000
commit142fdff0d5eb2b39df3254691cd00bf50f10cf36 (patch)
treefaf9d2ce9dc939a905701ae2c2cfc58a5423ad8f /llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
parent6c05d9135f13021622504d57309a559a60e8ae62 (diff)
downloadllvm-142fdff0d5eb2b39df3254691cd00bf50f10cf36.zip
llvm-142fdff0d5eb2b39df3254691cd00bf50f10cf36.tar.gz
llvm-142fdff0d5eb2b39df3254691cd00bf50f10cf36.tar.bz2
[dfsan] Correctly handle loads and stores of zero size.
llvm-svn: 214561
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 35057cdd..aa68ff5 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -1092,6 +1092,11 @@ Value *DFSanFunction::loadShadow(Value *Addr, uint64_t Size, uint64_t Align,
void DFSanVisitor::visitLoadInst(LoadInst &LI) {
uint64_t Size = DFSF.DFS.DL->getTypeStoreSize(LI.getType());
+ if (Size == 0) {
+ DFSF.setShadow(&LI, DFSF.DFS.ZeroShadow);
+ return;
+ }
+
uint64_t Align;
if (ClPreserveAlignment) {
Align = LI.getAlignment();
@@ -1166,6 +1171,9 @@ void DFSanFunction::storeShadow(Value *Addr, uint64_t Size, uint64_t Align,
void DFSanVisitor::visitStoreInst(StoreInst &SI) {
uint64_t Size =
DFSF.DFS.DL->getTypeStoreSize(SI.getValueOperand()->getType());
+ if (Size == 0)
+ return;
+
uint64_t Align;
if (ClPreserveAlignment) {
Align = SI.getAlignment();