diff options
author | Vitaly Buka <vitalybuka@google.com> | 2016-07-22 00:56:17 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2016-07-22 00:56:17 +0000 |
commit | 53054a7024f6353c6d3d300e556418739e546d47 (patch) | |
tree | 08bf4f92bbd120ddafc0cdded18e082320059ba3 /llvm/lib | |
parent | aae623f4c2965af735677312e2a5f070d25a5827 (diff) | |
download | bcm5719-llvm-53054a7024f6353c6d3d300e556418739e546d47.tar.gz bcm5719-llvm-53054a7024f6353c6d3d300e556418739e546d47.zip |
Fix detection of stack-use-after scope for char arrays.
Summary:
Clang inserts GetElementPtrInst so findAllocaForValue was not
able to find allocas.
PR27453
Reviewers: kcc, eugenis
Differential Revision: https://reviews.llvm.org/D22657
llvm-svn: 276374
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 43d1b377f85..27b68b0387d 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -2286,6 +2286,10 @@ AllocaInst *FunctionStackPoisoner::findAllocaForValue(Value *V) { return nullptr; Res = IncValueAI; } + } else if (GetElementPtrInst *EP = dyn_cast<GetElementPtrInst>(V)) { + Res = findAllocaForValue(EP->getPointerOperand()); + } else { + DEBUG(dbgs() << "Alloca search canceled on unknown instruction: " << *V << "\n"); } if (Res) AllocaForValue[V] = Res; return Res; |