diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-21 00:14:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-21 00:14:44 +0000 |
commit | 18e81933c7c2a00a4d7fc95c50e0dc4f339f1212 (patch) | |
tree | 16df5980a6f73a6df227fb9011e461db93ce650d /llvm/lib/Bytecode/Reader | |
parent | 9bc488984f43694600e2d3b3596117675fd0b42c (diff) | |
download | bcm5719-llvm-18e81933c7c2a00a4d7fc95c50e0dc4f339f1212.tar.gz bcm5719-llvm-18e81933c7c2a00a4d7fc95c50e0dc4f339f1212.zip |
Fix problem with a cast instruction that must be expanded to type 0
llvm-svn: 929
Diffstat (limited to 'llvm/lib/Bytecode/Reader')
-rw-r--r-- | llvm/lib/Bytecode/Reader/InstructionReader.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Bytecode/Reader/InstructionReader.cpp b/llvm/lib/Bytecode/Reader/InstructionReader.cpp index 58f2656559c..1f4aa68f4ae 100644 --- a/llvm/lib/Bytecode/Reader/InstructionReader.cpp +++ b/llvm/lib/Bytecode/Reader/InstructionReader.cpp @@ -48,6 +48,7 @@ bool BytecodeParser::ParseRawInst(const uchar *&Buf, const uchar *EndBuf, if (read_vbr(Buf, EndBuf, Result.Opcode)) return failure(true); if (read_vbr(Buf, EndBuf, Typ)) return failure(true); Result.Ty = getType(Typ); + if (Result.Ty == 0) return failure(true); if (read_vbr(Buf, EndBuf, Result.NumOperands)) return failure(true); switch (Result.NumOperands) { @@ -109,10 +110,13 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, Value *V; switch (Raw.Opcode) { - case Instruction::Cast: - Res = new CastInst(getValue(Raw.Ty, Raw.Arg1), getType(Raw.Arg2)); + case Instruction::Cast: { + V = getValue(Raw.Ty, Raw.Arg1); + const Type *Ty = getType(Raw.Arg2); + if (V == 0 || Ty == 0) { cerr << "Invalid cast!\n"; return true; } + Res = new CastInst(V, Ty); return false; - + } case Instruction::PHINode: { PHINode *PN = new PHINode(Raw.Ty); switch (Raw.NumOperands) { |