Skip to content

Commit

Permalink
Add testing for mismatched explicit type on a gep operator when loadi…
Browse files Browse the repository at this point in the history
…ng from bitcode

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232427 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dwblaikie committed Mar 16, 2015
1 parent 2a83bf6 commit 712d00b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,8 @@ std::error_code BitcodeReader::ParseConstants() {
bitc::CST_CODE_CE_INBOUNDS_GEP);
if (PointeeType &&
PointeeType != cast<GEPOperator>(V)->getSourceElementType())
return Error("Invalid record");
return Error("Explicit gep operator type does not match pointee type "
"of pointer operand");
break;
}
case bitc::CST_CODE_CE_SELECT: { // CE_SELECT: [opval#, opval#, opval#]
Expand Down
Binary file not shown.
3 changes: 3 additions & 0 deletions test/Bitcode/invalid.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-mismatched-explicit-type
RUN: FileCheck --check-prefix=MISMATCHED-EXPLICIT-GEP %s
RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-mismatched-explicit-type.bc 2>&1 | \
RUN: FileCheck --check-prefix=MISMATCHED-EXPLICIT-LOAD %s
RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-operator-mismatched-explicit-type.bc 2>&1 | \
RUN: FileCheck --check-prefix=MISMATCHED-EXPLICIT-GEP-OPERATOR %s

INVALID-ENCODING: Invalid encoding
BAD-ABBREV: Abbreviation starts with an Array or a Blob
Expand All @@ -26,6 +28,7 @@ BAD-BITWIDTH: Bitwidth for integer type out of range
BAD-ALIGN: Invalid alignment value
MISMATCHED-EXPLICIT-GEP: Explicit gep type does not match pointee type of pointer operand
MISMATCHED-EXPLICIT-LOAD: Explicit load type does not match pointee type of pointer operand
MISMATCHED-EXPLICIT-GEP-OPERATOR: Explicit gep operator type does not match pointee type of pointer operand

RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-array-idx.bc 2>&1 | \
RUN: FileCheck --check-prefix=EXTRACT-ARRAY %s
Expand Down

0 comments on commit 712d00b

Please sign in to comment.