Skip to content

Commit

Permalink
[MC] [Win64EH] Fix builds with expensive checks enabled
Browse files Browse the repository at this point in the history
This fixes a failed assert if expensive checks are enabled,
since 1308bb9.
  • Loading branch information
mstorsjo committed Sep 11, 2020
1 parent a68673c commit e6419d3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions llvm/lib/MC/MCWin64EH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,11 @@ static int checkPackedEpilog(MCStreamer &streamer, WinEH::FrameInfo *info,
if (DistanceFromEnd / 4 != Epilog.size())
return -1;

int Offset = ARM64CountOfUnwindCodes(
ArrayRef<WinEH::Instruction>(&info->Instructions[Epilog.size()],
info->Instructions.size() - Epilog.size()));
int Offset = Epilog.size() == info->Instructions.size()
? 0
: ARM64CountOfUnwindCodes(ArrayRef<WinEH::Instruction>(
&info->Instructions[Epilog.size()],
info->Instructions.size() - Epilog.size()));

// Check that the offset and prolog size fits in the first word; it's
// unclear whether the epilog count in the extension word can be taken
Expand Down

0 comments on commit e6419d3

Please sign in to comment.