diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-15 20:08:54 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-15 20:08:54 -0800 |
commit | 2e9c92a3fa82e44d9c6af871e61ff7f1a8e51732 (patch) | |
tree | 8644bccab9bfbc5aee93260cb7f3006e61a624d9 | |
parent | 57f1dd860a4148ab74b53534cf5d8c533e1a279a (diff) |
do not try to sign boolean constants
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index d5903a38d0..9f967977f5 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -1474,6 +1474,7 @@ std::string CppWriter::getConstant(const Constant* CV, AsmCast sign) { //if (S.find('.') == S.npos) { TODO: do this when necessary, but it is necessary even for 0.0001 return S; } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { + if (sign == ASM_SIGNED && CI->getValue().getBitWidth() == 1) sign = ASM_UNSIGNED; // booleans cannot be signed in a meaningful way return CI->getValue().toString(10, sign != ASM_UNSIGNED); } else if (isa<UndefValue>(CV)) { return CV->getType()->isIntegerTy() ? "0" : "+0"; // XXX fround, refactor this |