From 97e55fc173d6c934a640888ee220d7f75d56a23b Mon Sep 17 00:00:00 2001 From: Roger Chang Date: Wed, 9 Aug 2023 15:40:37 +0800 Subject: [PATCH] cpu: Fix segment fault when using debug flags Branch Change-Id: I36624b93f53aa101a57d51f3b917696cb2809136 --- src/cpu/pred/bpred_unit.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cpu/pred/bpred_unit.cc b/src/cpu/pred/bpred_unit.cc index ec751f7dc6..1bf51afe48 100644 --- a/src/cpu/pred/bpred_unit.cc +++ b/src/cpu/pred/bpred_unit.cc @@ -503,10 +503,12 @@ BPredUnit::squash(const InstSeqNum &squashed_sn, "return [sn:%llu] PC: %#x Restoring RAS\n", tid, squashed_sn, hist_it->seqNum, hist_it->pc); - DPRINTF(Branch, - "[tid:%i] [squash sn:%llu] Restoring top of RAS " - "to: %i, target: %s\n", tid, squashed_sn, - hist_it->RASIndex, *hist_it->RASTarget); + if (hist_it->RASTarget != nullptr) { + DPRINTF(Branch, + "[tid:%i] [squash sn:%llu] Restoring top of RAS " + "to: %i, target: %s\n", tid, squashed_sn, + hist_it->RASIndex, *hist_it->RASTarget.get()); + } RAS[tid].restore(hist_it->RASIndex, hist_it->RASTarget.get()); hist_it->usedRAS = false; }