diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-03-16 22:03:50 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-03-16 22:03:50 +0000 |
commit | 12cf5d70e81d6f4f57830d7c1d5fc3516637ffdb (patch) | |
tree | d425677b25159f981989cd5bd281fd7e8af31a42 | |
parent | 3fc1563ad7b126585071a2f8cc8a8fd56c515626 (diff) | |
download | bcm5719-llvm-12cf5d70e81d6f4f57830d7c1d5fc3516637ffdb.tar.gz bcm5719-llvm-12cf5d70e81d6f4f57830d7c1d5fc3516637ffdb.zip |
Add testing for mismatched explicit type on a gep operator when loading from bitcode
llvm-svn: 232427
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 3 | ||||
-rw-r--r-- | llvm/test/Bitcode/Inputs/invalid-gep-operator-mismatched-explicit-type.bc | bin | 0 -> 492 bytes | |||
-rw-r--r-- | llvm/test/Bitcode/invalid.test | 3 |
3 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index dd42bdb5804..a95ceead54e 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -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#] diff --git a/llvm/test/Bitcode/Inputs/invalid-gep-operator-mismatched-explicit-type.bc b/llvm/test/Bitcode/Inputs/invalid-gep-operator-mismatched-explicit-type.bc Binary files differnew file mode 100644 index 00000000000..3af687f056f --- /dev/null +++ b/llvm/test/Bitcode/Inputs/invalid-gep-operator-mismatched-explicit-type.bc diff --git a/llvm/test/Bitcode/invalid.test b/llvm/test/Bitcode/invalid.test index edf122b8dff..0eacb9dbbb1 100644 --- a/llvm/test/Bitcode/invalid.test +++ b/llvm/test/Bitcode/invalid.test @@ -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 @@ -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 |