aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2012-12-11 15:36:31 +0000
committerAlexander Kornienko <alexfh@google.com>2012-12-11 15:36:31 +0000
commitb50a126556a69df0fb68a190afdaf9850410fd4a (patch)
tree57e2fdf1caf960d8d878e0289f32af6759832b49 /lib/Support/APFloat.cpp
parentccaf20cc53a3dc353f4786b1ebf4ebb3f81d4746 (diff)
parent1ad9253c9d34ccbce3e7e4ea5d87c266cbf93410 (diff)
Updating branches/google/testing to r169803
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/google/testing@169870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r--lib/Support/APFloat.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index 7e8b4a3d0d..17f38918b3 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -19,8 +19,8 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
-#include <limits.h>
#include <cstring>
+#include <limits.h>
using namespace llvm;
@@ -2761,9 +2761,11 @@ APFloat::convertPPCDoubleDoubleAPFloatToAPInt() const
// normalize against the "double" minExponent first, and only *then*
// truncate the mantissa. The result of that second conversion
// may be inexact, but should never underflow.
- APFloat extended(*this);
+ // Declare fltSemantics before APFloat that uses it (and
+ // saves pointer to it) to ensure correct destruction order.
fltSemantics extendedSemantics = *semantics;
extendedSemantics.minExponent = IEEEdouble.minExponent;
+ APFloat extended(*this);
fs = extended.convert(extendedSemantics, rmNearestTiesToEven, &losesInfo);
assert(fs == opOK && !losesInfo);
(void)fs;