mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
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
This commit is contained in:
parent
0b6afa8c71
commit
4e9bac3769
@ -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");
|
||||
|
5
test/Assembler/2009-07-24-ZeroArgGEP.ll
Normal file
5
test/Assembler/2009-07-24-ZeroArgGEP.ll
Normal file
@ -0,0 +1,5 @@
|
||||
; RUN: llvm-as %s -o /dev/null -f
|
||||
|
||||
@foo = global i32 0
|
||||
@bar = constant i32* getelementptr(i32* @foo)
|
||||
|
Loading…
Reference in New Issue
Block a user