Giacomo Travaglini has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/53723 )
Change subject: ext: Fix segfalt in simulate_limit_event shortcut
......................................................................
ext: Fix segfalt in simulate_limit_event shortcut
In the SST integration the top of the main queue is checked
for an event before starting the simulation.
If the first event is scheduled after the ending tick, we are
just returning the simulate_limit_event without entering
the simulation loop.
If the method is called with an empty queue, the following
line will segfault (getHead() == nullptr):
gem5::mainEventQueue[0]->getHead()->when()
With this patch we are covering the case where we have
an empty event queue
Change-Id: I04463b45b269361172a9dd2fe1ba6e9428ac64f5
Signed-off-by: Giacomo Travaglini <[email protected]>
---
M ext/sst/gem5.cc
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/ext/sst/gem5.cc b/ext/sst/gem5.cc
index 924ee49..c93c722 100644
--- a/ext/sst/gem5.cc
+++ b/ext/sst/gem5.cc
@@ -285,8 +285,10 @@
// Here, if the next event in gem5's queue is not executed within the
next
// cycle, there's no need to enter the gem5's sim loop.
- if (next_end_tick < gem5::mainEventQueue[0]->getHead()->when())
+ if (gem5::mainEventQueue[0]->empty() ||
+ next_end_tick < gem5::mainEventQueue[0]->getHead()->when()) {
return gem5::simulate_limit_event;
+ }
gem5::simulate_limit_event->reschedule(next_end_tick);
gem5::Event *local_event = doSimLoop(gem5::mainEventQueue[0]);
gem5::BaseGlobalEvent *global_event = local_event->globalEvent();
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53723
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I04463b45b269361172a9dd2fe1ba6e9428ac64f5
Gerrit-Change-Number: 53723
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s