[Git][ghc/ghc][master] rts/nonmoving: Fix on LLP64 platforms

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Oct 5 09:36:58 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
8f6010b9 by Ben Gamari at 2023-10-05T05:35:36-04:00
rts/nonmoving: Fix on LLP64 platforms

Previously `NONMOVING_SEGMENT_MASK` and friends were defined with the `UL`
size suffix. However, this is wrong on LLP64 platforms like Windows,
where `long` is 32-bits.

Fixes #23003.
Fixes #24042.

- - - - -


1 changed file:

- rts/sm/NonMoving.h


Changes:

=====================================
rts/sm/NonMoving.h
=====================================
@@ -17,13 +17,13 @@
 #include "BeginPrivate.h"
 
 // Segments
-#define NONMOVING_SEGMENT_BITS 15UL   // 2^15 = 32kByte
+#define NONMOVING_SEGMENT_BITS 15ULL   // 2^15 = 32kByte
 // Mask to find base of segment
-#define NONMOVING_SEGMENT_MASK ((1UL << NONMOVING_SEGMENT_BITS) - 1)
+#define NONMOVING_SEGMENT_MASK (((uintptr_t)1 << NONMOVING_SEGMENT_BITS) - 1)
 // In bytes
-#define NONMOVING_SEGMENT_SIZE (1UL << NONMOVING_SEGMENT_BITS)
+#define NONMOVING_SEGMENT_SIZE ((uintptr_t)1 << NONMOVING_SEGMENT_BITS)
 // In words
-#define NONMOVING_SEGMENT_SIZE_W ((1UL << NONMOVING_SEGMENT_BITS) / SIZEOF_VOID_P)
+#define NONMOVING_SEGMENT_SIZE_W (((uintptr_t)1 << NONMOVING_SEGMENT_BITS) / SIZEOF_VOID_P)
 // In blocks
 #define NONMOVING_SEGMENT_BLOCKS (NONMOVING_SEGMENT_SIZE / BLOCK_SIZE)
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f6010b98f560200997a9d84a4e07bfd0ad6e496

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f6010b98f560200997a9d84a4e07bfd0ad6e496
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231005/f9771666/attachment.html>


More information about the ghc-commits mailing list