diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-07-24 21:56:17 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-07-24 21:56:17 +0000 |
commit | 5aeb251103a19f4c84636f3385c70157c5b6b8b3 (patch) | |
tree | a177b968364f6a7617362c4ba589f7aeee787b00 | |
parent | ace089079584cced3e3562d271f38b9d9ef3f8f8 (diff) | |
download | external_llvm-5aeb251103a19f4c84636f3385c70157c5b6b8b3.zip external_llvm-5aeb251103a19f4c84636f3385c70157c5b6b8b3.tar.gz external_llvm-5aeb251103a19f4c84636f3385c70157c5b6b8b3.tar.bz2 |
Fix assert assembling zero-argument constant GEP.
There's still a strict-aliasing violation here, but I don't feel like
dealing with that right now...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77005 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 5 | ||||
-rw-r--r-- | test/Assembler/2009-07-24-ZeroArgGEP.ll | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 94224a6..45e70c8 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -2017,10 +2017,11 @@ bool LLParser::ParseValID(ValID &ID) { return Error(ID.Loc, "getelementptr requires pointer operand"); if (!GetElementPtrInst::getIndexedType(Elts[0]->getType(), - (Value**)&Elts[1], Elts.size()-1)) + (Value**)(Elts.data() + 1), + Elts.size() - 1)) return Error(ID.Loc, "invalid indices for getelementptr"); ID.ConstantVal = Context.getConstantExprGetElementPtr(Elts[0], - &Elts[1], Elts.size()-1); + Elts.data() + 1, Elts.size() - 1); } else if (Opc == Instruction::Select) { if (Elts.size() != 3) return Error(ID.Loc, "expected three operands to select"); diff --git a/test/Assembler/2009-07-24-ZeroArgGEP.ll b/test/Assembler/2009-07-24-ZeroArgGEP.ll new file mode 100644 index 0000000..ce4a961 --- /dev/null +++ b/test/Assembler/2009-07-24-ZeroArgGEP.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as %s -o /dev/null -f + +@foo = global i32 0 +@bar = constant i32* getelementptr(i32* @foo) + |