APFloat(const fltSemantics &Semantics) : U(Semantics) {}
APFloat(const fltSemantics &Semantics, StringRef S);
APFloat(const fltSemantics &Semantics, integerPart I) : U(Semantics, I) {}
+ // TODO: Remove this constructor. This isn't faster than the first one.
APFloat(const fltSemantics &Semantics, uninitializedTag)
: U(Semantics, uninitialized) {}
APFloat(const fltSemantics &Semantics, const APInt &I) : U(Semantics, I) {}
sign = false;
}
-IEEEFloat::IEEEFloat(const fltSemantics &ourSemantics, uninitializedTag tag) {
+// Delegate to the previous constructor, because later copy constructor may
+// actually inspects category, which can't be garbage.
+IEEEFloat::IEEEFloat(const fltSemantics &ourSemantics, uninitializedTag tag)
+ : IEEEFloat(ourSemantics) {
// Allocates storage if necessary but does not initialize it.
initialize(&ourSemantics);
}
DoubleAPFloat::DoubleAPFloat(const DoubleAPFloat &RHS)
: Semantics(RHS.Semantics),
- Floats(new APFloat[2]{APFloat(RHS.Floats[0]), APFloat(RHS.Floats[1])}) {
+ Floats(RHS.Floats ? new APFloat[2]{APFloat(RHS.Floats[0]),
+ APFloat(RHS.Floats[1])}
+ : nullptr) {
assert(Semantics == &PPCDoubleDouble);
}
}
DoubleAPFloat &DoubleAPFloat::operator=(const DoubleAPFloat &RHS) {
- if (Semantics == RHS.Semantics) {
+ if (Semantics == RHS.Semantics && RHS.Floats) {
Floats[0] = RHS.Floats[0];
Floats[1] = RHS.Floats[1];
} else if (this != &RHS) {