Skip to content

Commit 1dc3ebf

Browse files
authored
SPU Analyzer: A fixup for crash, TODO: proper fix
1 parent 6bd1ab5 commit 1dc3ebf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

rpcs3/Emu/Cell/SPUCommonRecompiler.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4603,7 +4603,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point, s
46034603
{
46044604
bb.terminator = term_type::interrupt_call;
46054605
}
4606-
else if (last_inst != spu_itype::BISL && bb.targets[0] == tia + 4 && op.ra == s_reg_lr)
4606+
else if (last_inst != spu_itype::BISL && !bb.targets.empty() && bb.targets[0] == tia + 4 && op.ra == s_reg_lr)
46074607
{
46084608
// Conditional return (TODO)
46094609
bb.terminator = term_type::ret;
@@ -4728,9 +4728,11 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point, s
47284728
if (is_ok && bb.terminator == term_type::fallthrough)
47294729
{
47304730
// Can't just fall out of the function
4731-
if (bb.targets.size() != 1 || bb.targets[0] >= flim)
4731+
const auto bb_target_value = bb.targets.empty() ? 0 : bb.targets[0];
4732+
4733+
if (bb.targets.size() != 1 || bb_target_value >= flim)
47324734
{
4733-
spu_log.error("Function 0x%05x: [0x%05x] bad fallthrough to 0x%x", f.first, addr, bb.targets[0]);
4735+
spu_log.error("Function 0x%05x: [0x%05x] bad fallthrough to 0x%x", f.first, addr, bb_target_value);
47344736
is_ok = false;
47354737
}
47364738
}

0 commit comments

Comments
 (0)