[llvm] r232424 - Add testing for mismatched explicit type on a load instruction when loading from bitcode
David Blaikie
dblaikie at gmail.com
Mon Mar 16 14:48:47 PDT 2015
Author: dblaikie
Date: Mon Mar 16 16:48:46 2015
New Revision: 232424
URL: http://llvm.org/viewvc/llvm-project?rev=232424&view=rev
Log:
Add testing for mismatched explicit type on a load instruction when loading from bitcode
Added:
llvm/trunk/test/Bitcode/Inputs/invalid-load-mismatched-explicit-type.bc
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/test/Bitcode/invalid.test
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=232424&r1=232423&r2=232424&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Mar 16 16:48:46 2015
@@ -3648,9 +3648,9 @@ std::error_code BitcodeReader::ParseFunc
return EC;
I = new LoadInst(Op, "", Record[OpNum+1], Align);
- (void)Ty;
- assert((!Ty || Ty == I->getType()) &&
- "Explicit type doesn't match pointee type of the first operand");
+ if (Ty && Ty != I->getType())
+ return Error("Explicit load type does not match pointee type of "
+ "pointer operand");
InstructionList.push_back(I);
break;
Added: llvm/trunk/test/Bitcode/Inputs/invalid-load-mismatched-explicit-type.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/Inputs/invalid-load-mismatched-explicit-type.bc?rev=232424&view=auto
==============================================================================
Binary files llvm/trunk/test/Bitcode/Inputs/invalid-load-mismatched-explicit-type.bc (added) and llvm/trunk/test/Bitcode/Inputs/invalid-load-mismatched-explicit-type.bc Mon Mar 16 16:48:46 2015 differ
Modified: llvm/trunk/test/Bitcode/invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.test?rev=232424&r1=232423&r2=232424&view=diff
==============================================================================
--- llvm/trunk/test/Bitcode/invalid.test (original)
+++ llvm/trunk/test/Bitcode/invalid.test Mon Mar 16 16:48:46 2015
@@ -14,6 +14,8 @@ RUN: not llvm-dis -disable-output %p/Inp
RUN: FileCheck --check-prefix=BAD-ALIGN %s
RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-mismatched-explicit-type.bc 2>&1 | \
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
INVALID-ENCODING: Invalid encoding
BAD-ABBREV: Abbreviation starts with an Array or a Blob
@@ -23,6 +25,7 @@ BAD-TYPE-TABLE-FORWARD-REF: Invalid TYPE
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
RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-array-idx.bc 2>&1 | \
RUN: FileCheck --check-prefix=EXTRACT-ARRAY %s
More information about the llvm-commits
mailing list