diff options
author | Ciro Santilli <ciro.santilli@arm.com> | 2019-08-06 16:17:51 +0100 |
---|---|---|
committer | Ciro Santilli <ciro.santilli@arm.com> | 2019-08-21 12:16:48 +0000 |
commit | acad54cf4e01809170e343b13f302fc5b032c366 (patch) | |
tree | bbbc01d4d91560019c33b840bdc984f0672bc3fa /src/base/statistics.hh | |
parent | b192aed7e73a60d49bf560c0c8c478dfcf219de1 (diff) | |
download | gem5-acad54cf4e01809170e343b13f302fc5b032c366.tar.xz |
base: assert that stats bucket size is greater than 0
Change-Id: I9a2264e9ee74acea1f09f01ea8f5004567ba1ea8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20049
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/base/statistics.hh')
-rw-r--r-- | src/base/statistics.hh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 69a2afffc..6ddf7ff17 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -2533,6 +2533,9 @@ class Distribution : public DistBase<Distribution, DistStor> params->min = min; params->max = max; params->bucket_size = bkt; + // Division by zero is especially serious in an Aarch64 host, + // where it gets rounded to allocate 32GiB RAM. + assert(bkt > 0); params->buckets = (size_type)ceil((max - min + 1.0) / bkt); this->setParams(params); this->doInit(); |