[Git][ghc/ghc][master] 2 commits: testsuite: Fix out-of-bounds access in T3586
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 4bfbf5c8 by ARATA Mizuki at 2026-09-01T18:55:08-04:00 testsuite: Fix out-of-bounds access in T3586 unsafeRead and unsafeWrite use 0-based index. Looking at #3586, the expected output seems to be 2.8e8. Addresses #27596 - - - - - 3f9db6d4 by ARATA Mizuki at 2026-09-01T18:55:08-04:00 testsuite: Fix out-of-bounds access in T21305 writeInt64Array# takes an index measured in units of Int64 elements. Fixes #27596 - - - - - 3 changed files: - testsuite/tests/ffi/should_run/T21305.hs - testsuite/tests/perf/should_run/T3586.hs - testsuite/tests/perf/should_run/T3586.stdout Changes: ===================================== testsuite/tests/ffi/should_run/T21305.hs ===================================== @@ -45,4 +45,4 @@ writeByteArray# :: MutableByteArray# RealWorld writeByteArray# _ _ [] s = s writeByteArray# mba off (I64# i:is) s = case writeInt64Array# mba off i s of - s' -> writeByteArray# mba (off +# 8#) is s' + s' -> writeByteArray# mba (off +# 1#) is s' ===================================== testsuite/tests/perf/should_run/T3586.hs ===================================== @@ -14,7 +14,8 @@ go :: STUArray s Int Double -> Int -> Double -> ST s Double go !a i !acc | i < 1 = return acc | otherwise = do - b <- unsafeRead a i - unsafeWrite a i (b+3.0) - c <- unsafeRead a i + -- unsafeRead/unsafeWrite use 0-based index + b <- unsafeRead a (i-1) + unsafeWrite a (i-1) (b+3.0) + c <- unsafeRead a (i-1) go a (i-1) (c+acc) ===================================== testsuite/tests/perf/should_run/T3586.stdout ===================================== @@ -1 +1 @@ -2.79999863e8 +2.8e8 View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4117e5ae711b9d7f6dd1f59362916aa... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4117e5ae711b9d7f6dd1f59362916aa... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Marge Bot (@marge-bot)