mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-29 15:17:14 +00:00
Test bitcode parsing error-handling for incorrect explicit type
(turns out I had regressed this when sinking handling of this type down into GetElementPtrInst::Create - since that asserted before the error handling was performed) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232420 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3123,6 +3123,13 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
if (getValueTypePair(Record, OpNum, NextValueNo, BasePtr))
|
||||
return Error("Invalid record");
|
||||
|
||||
if (Ty &&
|
||||
Ty !=
|
||||
cast<SequentialType>(BasePtr->getType()->getScalarType())
|
||||
->getElementType())
|
||||
return Error(
|
||||
"Explicit gep type does not match pointee type of pointer operand");
|
||||
|
||||
SmallVector<Value*, 16> GEPIdx;
|
||||
while (OpNum != Record.size()) {
|
||||
Value *Op;
|
||||
@@ -3132,8 +3139,7 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
}
|
||||
|
||||
I = GetElementPtrInst::Create(Ty, BasePtr, GEPIdx);
|
||||
if (Ty && Ty != cast<GetElementPtrInst>(I)->getSourceElementType())
|
||||
return Error("Invalid record");
|
||||
|
||||
InstructionList.push_back(I);
|
||||
if (InBounds)
|
||||
cast<GetElementPtrInst>(I)->setIsInBounds(true);
|
||||
|
Reference in New Issue
Block a user