Gabe Black has submitted this change. (
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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41597
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/cpu/testers/traffic_gen/traffic_gen.cc
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/cpu/testers/traffic_gen/traffic_gen.cc
b/src/cpu/testers/traffic_gen/traffic_gen.cc
index 1ea4d5e..6e1a00a 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::fabs(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: 4
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: Tiago Mück <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s