From 98cfc17843edf26d85b1030cb4236a9469bdec46 Mon Sep 17 00:00:00 2001 From: jbrodman Date: Tue, 4 Feb 2014 08:12:02 -0800 Subject: [PATCH] Fix bug with printing due to uneven handling of bool types --- stmt.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stmt.cpp b/stmt.cpp index 4ec63d35..52d25fe9 100644 --- a/stmt.cpp +++ b/stmt.cpp @@ -3003,6 +3003,14 @@ lProcessPrintArg(Expr *expr, FunctionEmitContext *ctx, std::string &argTypes) { return NULL; } else { + if (Type::Equal(baseType, AtomicType::UniformBool)) { + // Blast bools to ints, but do it here to preserve encoding for + // printing 'true' or 'false' + expr = new TypeCastExpr(type->IsUniformType() ? AtomicType::UniformInt32 : + AtomicType::VaryingInt32, + expr, expr->pos); + type = expr->GetType(); + } argTypes.push_back(t); llvm::Type *llvmExprType = type->LLVMType(g->ctx);