From 33bd2d99d81a08c1fffea4ffb51d692950f0ceae Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 7 Oct 2015 17:49:32 +0000 Subject: [WinEH] Fix two minor issues in __CxxFrameHandler3 tables There was an off-by-one bug in ip2state tables which manifested when one call immediately preceded the try-range of the next. The return address of the previous call would appear to be within the try range of the next scope, resulting in extra destructors or catches running. We also computed the wrong offset for catch parameter stack objects. The offset should be from RSP, not from RBP. llvm-svn: 249578 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp') diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 63825b5..495da5c 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -820,12 +820,11 @@ void PEI::replaceFrameIndices(MachineFunction &Fn) { Fn, FuncInfo.UnwindHelpFrameIdx, FrameReg); for (WinEHTryBlockMapEntry &TBME : FuncInfo.TryBlockMap) { for (WinEHHandlerType &H : TBME.HandlerArray) { - unsigned UnusedReg; if (H.CatchObj.FrameIndex == INT_MAX) H.CatchObj.FrameOffset = INT_MAX; else - H.CatchObj.FrameOffset = - TFI.getFrameIndexReference(Fn, H.CatchObj.FrameIndex, UnusedReg); + H.CatchObj.FrameOffset = TFI.getFrameIndexReferenceFromSP( + Fn, H.CatchObj.FrameIndex, FrameReg); } } } -- cgit v1.1