Index: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp =================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2377,6 +2377,8 @@ CurTy = flattenPointerTypes(CurFullTy); continue; // Skip the ValueList manipulation. case bitc::CST_CODE_NULL: // NULL + if (CurTy->isVoidTy() || CurTy->isFunctionTy() || CurTy->isLabelTy()) + return error("Invalid type for a constant null value"); V = Constant::getNullValue(CurTy); break; case bitc::CST_CODE_INTEGER: // INTEGER: [intval] Index: llvm/trunk/test/Bitcode/invalid-type-for-null-constant.ll =================================================================== --- llvm/trunk/test/Bitcode/invalid-type-for-null-constant.ll +++ llvm/trunk/test/Bitcode/invalid-type-for-null-constant.ll @@ -0,0 +1,6 @@ +; Bitcode with a CST_CODE_NULL with void type. + +; RUN: not llvm-dis %s.bc -o - 2>&1 | FileCheck %s + +; CHECK: error: Invalid type for a constant null value +