Revert rL360675 : [APFloat] APFloat::Storage::Storage - fix use after move
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 15 May 2019 13:03:10 +0000 (13:03 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 15 May 2019 13:03:10 +0000 (13:03 +0000)
This was mentioned both in https://www.viva64.com/en/b/0629/ and by scan-build checks
........
There's concerns this may just introduce a use-after-free instead.....

llvm-svn: 360770

llvm/lib/Support/APFloat.cpp

index aea5930..208950d 100644 (file)
@@ -4418,9 +4418,9 @@ APFloat::Storage::Storage(IEEEFloat F, const fltSemantics &Semantics) {
     return;
   }
   if (usesLayout<DoubleAPFloat>(Semantics)) {
-    const fltSemantics IEEESemantics = F.getSemantics();
-    new (&Double) DoubleAPFloat(Semantics, APFloat(std::move(F), IEEESemantics),
-                                APFloat(semIEEEdouble));
+    new (&Double)
+        DoubleAPFloat(Semantics, APFloat(std::move(F), F.getSemantics()),
+                      APFloat(semIEEEdouble));
     return;
   }
   llvm_unreachable("Unexpected semantics");