Silly bug: don't pass NULL to the print() stmt when we want a llvm::Value * that has the value NULL.

(This was causing crashes with print() statements with no additional values to
  be printed.)
This commit is contained in:
Matt Pharr
2011-08-25 07:48:13 +01:00
parent e14208f489
commit b0f59777d4

View File

@@ -1464,8 +1464,11 @@ PrintStmt::EmitCode(FunctionEmitContext *ctx) const {
llvm::Value *args[5];
std::string argTypes;
if (values == NULL)
args[4] = NULL;
if (values == NULL) {
LLVM_TYPE_CONST llvm::Type *ptrPtrType =
llvm::PointerType::get(LLVMTypes::VoidPointerType, 0);
args[4] = llvm::Constant::getNullValue(ptrPtrType);
}
else {
// Get the values passed to the print() statement evaluated and
// stored in memory so that we set up the array of pointers to them