diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-10-25 16:28:35 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-10-25 16:28:35 +0000 |
commit | a2cbe6c5b5c781a7c4125792a31d3670a777a3b7 (patch) | |
tree | ff481b11df095c084e91d10eee42b9d0ed4079f3 /lib/VMCore/Verifier.cpp | |
parent | 46fa139e26be6ebc00be2fb45820c2560dd22a32 (diff) | |
download | external_llvm-a2cbe6c5b5c781a7c4125792a31d3670a777a3b7.zip external_llvm-a2cbe6c5b5c781a7c4125792a31d3670a777a3b7.tar.gz external_llvm-a2cbe6c5b5c781a7c4125792a31d3670a777a3b7.tar.bz2 |
Related to PR2911, reject as invalid non-pointer GC roots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58143 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 3ca9d8c8..f8dd24c 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -1347,8 +1347,10 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { case Intrinsic::gcwrite: case Intrinsic::gcread: if (ID == Intrinsic::gcroot) { - Assert1(isa<AllocaInst>(CI.getOperand(1)->stripPointerCasts()), - "llvm.gcroot parameter #1 must be an alloca.", &CI); + AllocaInst *AI = + dyn_cast<AllocaInst>(CI.getOperand(1)->stripPointerCasts()); + Assert1(AI && isa<PointerType>(AI->getType()->getElementType()), + "llvm.gcroot parameter #1 must be a pointer alloca.", &CI); Assert1(isa<Constant>(CI.getOperand(2)), "llvm.gcroot parameter #2 must be a constant.", &CI); } |