summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Bueno <javier.bueno@metempsy.com>2018-11-15 16:19:45 +0100
committerJavier Bueno Hedo <javier.bueno@metempsy.com>2018-11-15 17:31:10 +0000
commit338a173e822298bd22741342a7b24352450afdd1 (patch)
treecfc3b8658468f4f26a5814b4c18f70ab601a4acc
parent153a33be851190acdec443264c3a1f1dfa44592a (diff)
downloadgem5-338a173e822298bd22741342a7b24352450afdd1.tar.xz
mem-cache: fix invalid iterator access
An iterator was assigned end() and then it was used to access its corresponding element. Change-Id: I87246cf56cbc694dd6b4e2cabbe84a08429d2ac3 Reviewed-on: https://gem5-review.googlesource.com/c/14361 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
-rw-r--r--src/mem/cache/prefetch/queued.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mem/cache/prefetch/queued.cc b/src/mem/cache/prefetch/queued.cc
index ce14b5ac5..ba4c940c1 100644
--- a/src/mem/cache/prefetch/queued.cc
+++ b/src/mem/cache/prefetch/queued.cc
@@ -265,8 +265,9 @@ QueuedPrefetcher::insert(AddrPriority &pf_info, bool is_secure)
pfq.emplace_back(dpp);
} else {
iterator it = pfq.end();
- while (it != pfq.begin() && dpp > *it)
+ do {
--it;
+ } while (it != pfq.begin() && dpp > *it);
/* If we reach the head, we have to see if the new element is new head
* or not */
if (it == pfq.begin() && dpp <= *it)