From 11c341f722d05864042b0ec8d3b3032cd71a43b1 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 21 Apr 2020 16:11:33 -0700 Subject: [PATCH] Fixes accessing a stack variable post destruction bug This happened to work with clang-9 but is caught in clang-10 now. We were constructing an iterator temp then pulling a node through it past the destruction. Remove the iterator construction entirely and removes the unused lambda from the AArch64 JIT that had the same problem. --- .../Source/Interface/Core/Interpreter/InterpreterCore.cpp | 5 ++--- External/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp | 7 ------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/External/FEXCore/Source/Interface/Core/Interpreter/InterpreterCore.cpp b/External/FEXCore/Source/Interface/Core/Interpreter/InterpreterCore.cpp index 668900f67..7420ef469 100644 --- a/External/FEXCore/Source/Interface/Core/Interpreter/InterpreterCore.cpp +++ b/External/FEXCore/Source/Interface/Core/Interpreter/InterpreterCore.cpp @@ -141,9 +141,8 @@ void InterpreterCore::ExecuteCode(FEXCore::Core::InternalThreadState *Thread) { #define GD *GetDest(*WrapperOp) #define GDP GetDest(*WrapperOp) auto GetOpSize = [&](IR::OrderedNodeWrapper Node) { - auto Wrapper = CurrentIR->at(Node)(); - FEXCore::IR::OrderedNode *RealNode = Wrapper->GetNode(ListBegin); - FEXCore::IR::IROp_Header *IROp = RealNode->Op(DataBegin); + FEXCore::IR::OrderedNode const *RealNode = Node.GetNode(ListBegin); + FEXCore::IR::IROp_Header const *IROp = RealNode->Op(DataBegin); return IROp->Size; }; diff --git a/External/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp b/External/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp index 15e880659..fdadd9ada 100644 --- a/External/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp +++ b/External/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp @@ -393,13 +393,6 @@ void *JITCore::CompileCode([[maybe_unused]] FEXCore::IR::IRListView const IR::OrderedNode *BlockNode = HeaderOp->Blocks.GetNode(ListBegin); - auto GetOpSize = [&](IR::OrderedNodeWrapper Node) { - auto Wrapper = CurrentIR->at(Node)(); - FEXCore::IR::OrderedNode *RealNode = Wrapper->GetNode(ListBegin); - FEXCore::IR::IROp_Header *IROp = RealNode->Op(DataBegin); - return IROp->Size; - }; - while (1) { using namespace FEXCore::IR; auto BlockIROp = BlockNode->Op(DataBegin)->CW();