From 87dc1820c08e02cc13b99b97275ca7e9827895e4 Mon Sep 17 00:00:00 2001 From: Tomohiro Date: Tue, 2 Sep 2025 01:29:58 +0900 Subject: [PATCH] fixes overflow defect when compiled with js backend (#25132) Follow up to https://github.com/nim-lang/Nim/pull/25126. This fixes overflow defect when `tests/stdlib/tstrutils.nim` was compiled with js backend. --- tests/stdlib/tstrutils.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/stdlib/tstrutils.nim b/tests/stdlib/tstrutils.nim index a21a337bd5..dfa72faf22 100644 --- a/tests/stdlib/tstrutils.nim +++ b/tests/stdlib/tstrutils.nim @@ -789,8 +789,8 @@ bar block: # formatSize disableVm: when hasWorkingInt64: - doAssert formatSize(1024 * 1024 * 1024 * 2 - 1) == "1.999GiB" - doAssert formatSize(1024 * 1024 * 1024 * 2) == "2GiB" + doAssert formatSize(1024'i64 * 1024 * 1024 * 2 - 1) == "1.999GiB" + doAssert formatSize(1024'i64 * 1024 * 1024 * 2) == "2GiB" doAssert formatSize((1'i64 shl 31) + (300'i64 shl 20)) == "2.293GiB" # <=== bug #8231 doAssert formatSize(int64.high) == "7.999EiB" doAssert formatSize(int64.high div 2 + 1) == "4EiB"