Make temporaries explicit to avoid premature
[oota-llvm.git] / lib / Target / CBackend / CBackend.cpp
index bc085241d05040eb237e221859087d8794b9a891..6eef297dd663d58f9e39d7ee9c1d4c9cef47ae59 100644 (file)
@@ -1729,7 +1729,9 @@ void CWriter::printFloatingPointConstants(Function &F) {
               << " = 0x" << std::hex << i << std::dec
               << "U;    /* " << Val << " */\n";
         } else if (FPC->getType() == Type::X86_FP80Ty) {
-          const uint64_t *p = FPC->getValueAPF().convertToAPInt().getRawData();
+          // api needed to prevent premature destruction
+          APInt api = FPC->getValueAPF().convertToAPInt();
+          const uint64_t *p = api.getRawData();
           Out << "static const ConstantFP80Ty FPConstant" << FPCounter++
               << " = { 0x" << std::hex
               << ((uint16_t)p[1] | (p[0] & 0xffffffffffffLL)<<16)