]> granicus.if.org Git - llvm/commitdiff
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.....

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360770 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APFloat.cpp

index aea59301079e768eb8a666b1780b3508b0c27cec..208950d7ab714b3052b51161b6025de441217307 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");