From b0f59777d454e233fbc9eabf95bde2f3a1ffa160 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Thu, 25 Aug 2011 07:48:13 +0100 Subject: [PATCH] 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.) --- stmt.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stmt.cpp b/stmt.cpp index 434a4b85..20637553 100644 --- a/stmt.cpp +++ b/stmt.cpp @@ -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