From 75257c7a4272d3682a5779407ac5812e326043df Mon Sep 17 00:00:00 2001 From: seanzw Date: Tue, 14 Jul 2020 15:51:59 -0700 Subject: [PATCH] mem-ruby: Fix type casting in makeNextStrideAddress The RubyPrefetcher uses makeNextStrideAddress() with a negative stride to find prefetched address. The type of this expression is: uint64_t + uint32_t * int; This gives wrong result due to implicit conversion. Fix this with static cast and it works correctly: uint64_t + int * int; Change-Id: I36e17e00d5c66c3699fe1d5b287971225a162d04 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31314 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/mem/ruby/common/Address.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mem/ruby/common/Address.cc b/src/mem/ruby/common/Address.cc index 39de974a5..fd3c43e1b 100644 --- a/src/mem/ruby/common/Address.cc +++ b/src/mem/ruby/common/Address.cc @@ -66,7 +66,8 @@ makeLineAddress(Addr addr, int cacheLineBits) Addr makeNextStrideAddress(Addr addr, int stride) { - return makeLineAddress(addr) + RubySystem::getBlockSizeBytes() * stride; + return makeLineAddress(addr) + + static_cast(RubySystem::getBlockSizeBytes()) * stride; } std::string -- 2.30.2