[PATCH] D62113: [Bugpoint] fix use-after-move. NFC

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 18:35:11 PDT 2019


nickdesaulniers created this revision.
nickdesaulniers added reviewers: echristo, srhines.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No.
6".

Note that author also states:
"Note that the loop doesn't actually execute at all."

This is not true, but the author can be forgiven; there's two distinct
variables with very similar identifiers:

MiscompiledFunctions
MisCompFunctions


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62113

Files:
  llvm/tools/bugpoint/Miscompilation.cpp


Index: llvm/tools/bugpoint/Miscompilation.cpp
===================================================================
--- llvm/tools/bugpoint/Miscompilation.cpp
+++ llvm/tools/bugpoint/Miscompilation.cpp
@@ -591,9 +591,6 @@
   if (Linker::linkModules(*ProgClone, std::move(Extracted)))
     exit(1);
 
-  // Set the new program and delete the old one.
-  BD.setNewProgram(std::move(ProgClone));
-
   // Update the list of miscompiled functions.
   MiscompiledFunctions.clear();
 
@@ -603,6 +600,9 @@
     MiscompiledFunctions.push_back(NewF);
   }
 
+  // Set the new program and delete the old one.
+  BD.setNewProgram(std::move(ProgClone));
+
   return true;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62113.200192.patch
Type: text/x-patch
Size: 662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190520/45d3b8a0/attachment.bin>


More information about the llvm-commits mailing list