mem-cache: Avoid calling .front() on a possibly empty std::list

In the call to MSHR::promoteWritable() the deferredTargets list can be
empty, so we should check that case before calling .front(). The new logic
matches MSHR::promoteReadable().

Change-Id: Ic1d05e42f32b2c02226ca88d2155225f592f667f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57249
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Alex Richardson
2022-03-01 13:38:12 +00:00
parent a3e481c024
commit 6de0156cf7

View File

@@ -678,6 +678,9 @@ MSHR::promoteReadable()
void
MSHR::promoteWritable()
{
if (deferredTargets.empty()) {
return;
}
PacketPtr def_tgt_pkt = deferredTargets.front().pkt;
if (deferredTargets.needsWritable &&
!(hasPostInvalidate() || hasPostDowngrade()) &&