# HG changeset patch # User Christian Kamm # Date 1226346924 -3600 # Node ID 2c730d530c98e8454dbc7b633103f5d90b2d942d # Parent a58784e0f035d153a73dae5c09d2b781a0080f93 Special case DtoCastInt for bool. diff -r a58784e0f035 -r 2c730d530c98 gen/llvmhelpers.cpp --- a/gen/llvmhelpers.cpp Sat Nov 08 22:29:19 2008 +0100 +++ b/gen/llvmhelpers.cpp Mon Nov 10 20:55:24 2008 +0100 @@ -570,7 +570,7 @@ } if (to->isintegral()) { - if (fromsz < tosz) { + if (fromsz < tosz || from->ty == Tbool) { if (Logger::enabled()) Logger::cout() << "cast to: " << *tolltype << '\n'; if (from->isunsigned() || from->ty == Tbool) { @@ -579,7 +579,7 @@ rval = new llvm::SExtInst(rval, tolltype, "tmp", gIR->scopebb()); } } - else if (fromsz > tosz) { + else if (fromsz > tosz || to->ty == Tbool) { rval = new llvm::TruncInst(rval, tolltype, "tmp", gIR->scopebb()); } else {