base: assert that stats bucket size is greater than 0
authorCiro Santilli <ciro.santilli@arm.com>
Tue, 6 Aug 2019 15:17:51 +0000 (16:17 +0100)
committerCiro Santilli <ciro.santilli@arm.com>
Wed, 21 Aug 2019 12:16:48 +0000 (12:16 +0000)
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>
src/base/statistics.hh

index 69a2afffcb4ddda31d33343e7e876d34c49e2965..6ddf7ff17beb95f65f3f8ee3e04433bb8a8f89dd 100644 (file)
@@ -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();