Hello Giacomo Travaglini, Andreas Sandberg,

I'd like you to do a code review. Please visit

    https://gem5-review.googlesource.com/c/public/gem5/+/14361

to review the following change.


Change subject: mem-cache: fix invalid iterator access
......................................................................

mem-cache: fix invalid iterator access

An iterator was assigned end() and then it was used to access
its corresponding element.

Change-Id: I87246cf56cbc694dd6b4e2cabbe84a08429d2ac3
---
M src/mem/cache/prefetch/queued.cc
1 file changed, 2 insertions(+), 1 deletion(-)



diff --git a/src/mem/cache/prefetch/queued.cc b/src/mem/cache/prefetch/queued.cc
index f9a036d..edea376 100644
--- a/src/mem/cache/prefetch/queued.cc
+++ b/src/mem/cache/prefetch/queued.cc
@@ -266,8 +266,9 @@
         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)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14361
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I87246cf56cbc694dd6b4e2cabbe84a08429d2ac3
Gerrit-Change-Number: 14361
Gerrit-PatchSet: 1
Gerrit-Owner: Javier Bueno Hedo <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to