[MC] [Win64EH] Fix builds with expensive checks enabled

This fixes a failed assert if expensive checks are enabled,
since 1308bb99e0.
This commit is contained in:
Martin Storsjö 2020-09-11 11:14:45 +03:00
parent a68673cc06
commit e6419d320d
1 changed files with 5 additions and 3 deletions

View File

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