Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/41597 )
Change subject: cpu: Use std::abs() in traffic_gen.cc.
......................................................................
cpu: Use std::abs() in traffic_gen.cc.
When building with clang with the --without-tcmalloc flag set, the
-fno-builtin flag is not used, and clang can then detect that the
integer version of abs(), apparently the C version, is being used on a
floating point value in traffic_gen.cc.
This change takes clang's suggestion to use std::abs instead, and also
includes a header file which will provide it.
Change-Id: Ic28ed7454b2ac00c89328d9d0314aed74e946643
---
M src/cpu/testers/traffic_gen/traffic_gen.cc
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/cpu/testers/traffic_gen/traffic_gen.cc
b/src/cpu/testers/traffic_gen/traffic_gen.cc
index 1ea4d5e..97b6e65 100644
--- a/src/cpu/testers/traffic_gen/traffic_gen.cc
+++ b/src/cpu/testers/traffic_gen/traffic_gen.cc
@@ -39,6 +39,7 @@
#include <libgen.h>
#include <unistd.h>
+#include <cmath>
#include <fstream>
#include <sstream>
@@ -331,9 +332,10 @@
}
// avoid comparing floating point numbers
- if (abs(sum - 1.0) > 0.001)
+ if (std::abs(sum - 1.0) > 0.001) {
fatal("%s has transition probability != 1 for state %d\n",
name(), i);
+ }
}
// close input file
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41597
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: Ic28ed7454b2ac00c89328d9d0314aed74e946643
Gerrit-Change-Number: 41597
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s