[llvm-commits] [llvm] r77005 - in /llvm/trunk: lib/AsmParser/LLParser.cpp test/Assembler/2009-07-24-ZeroArgGEP.ll
Eli Friedman
eli.friedman at gmail.com
Fri Jul 24 14:56:17 PDT 2009
Author: efriedma
Date: Fri Jul 24 16:56:17 2009
New Revision: 77005
URL: http://llvm.org/viewvc/llvm-project?rev=77005&view=rev
Log:
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...
Added:
llvm/trunk/test/Assembler/2009-07-24-ZeroArgGEP.ll
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77005&r1=77004&r2=77005&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Fri Jul 24 16:56:17 2009
@@ -2017,10 +2017,11 @@
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");
Added: llvm/trunk/test/Assembler/2009-07-24-ZeroArgGEP.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2009-07-24-ZeroArgGEP.ll?rev=77005&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/2009-07-24-ZeroArgGEP.ll (added)
+++ llvm/trunk/test/Assembler/2009-07-24-ZeroArgGEP.ll Fri Jul 24 16:56:17 2009
@@ -0,0 +1,5 @@
+; RUN: llvm-as %s -o /dev/null -f
+
+ at foo = global i32 0
+ at bar = constant i32* getelementptr(i32* @foo)
+
More information about the llvm-commits
mailing list