Daniel Carvalho has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/43011 )
Change subject: base-stats: Fix self addition bug in addStatGroup
......................................................................
base-stats: Fix self addition bug in addStatGroup
A group cannot be added to itself; otherwise, it would
create a cyclic dependency.
Change-Id: I2e42f84814c675e8d5318cfda2d99b1b394758aa
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/base/stats/group.cc
M src/base/stats/group.test.cc
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/base/stats/group.cc b/src/base/stats/group.cc
index 1852c0c..9e50c45 100644
--- a/src/base/stats/group.cc
+++ b/src/base/stats/group.cc
@@ -110,6 +110,7 @@
void
Group::addStatGroup(const char *name, Group *block)
{
+ panic_if(block == this, "Stat group can't be added to itself");
panic_if(statGroups.find(name) != statGroups.end(),
"Stats of the same group share the same name `%s`.\n", name);
diff --git a/src/base/stats/group.test.cc b/src/base/stats/group.test.cc
index f563dba..23e9a3b 100644
--- a/src/base/stats/group.test.cc
+++ b/src/base/stats/group.test.cc
@@ -84,7 +84,7 @@
}
/** Test that a group cannot add itself. */
-TEST(StatsGroupDeathTest, DISABLED_AddItself)
+TEST(StatsGroupDeathTest, AddItself)
{
Stats::Group root(nullptr);
ASSERT_ANY_THROW(root.addStatGroup("Node1", &root));
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/43011
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: I2e42f84814c675e8d5318cfda2d99b1b394758aa
Gerrit-Change-Number: 43011
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[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