[llvm] r360770 - Revert rL360675 : [APFloat] APFloat::Storage::Storage - fix use after move

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 06:03:11 PDT 2019


Author: rksimon
Date: Wed May 15 06:03:10 2019
New Revision: 360770

URL: http://llvm.org/viewvc/llvm-project?rev=360770&view=rev
Log:
Revert rL360675 : [APFloat] APFloat::Storage::Storage - fix use after move

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.....

Modified:
    llvm/trunk/lib/Support/APFloat.cpp

Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=360770&r1=360769&r2=360770&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Wed May 15 06:03:10 2019
@@ -4418,9 +4418,9 @@ APFloat::Storage::Storage(IEEEFloat F, c
     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");




More information about the llvm-commits mailing list