RTS: Fix restrictive cast
authorAlec Theriault <alec.theriault@gmail.com>
Mon, 13 May 2019 22:31:56 +0000 (15:31 -0700)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 22 May 2019 20:48:45 +0000 (16:48 -0400)
commitecc9366a0e0db107c286935130837b2222e2dd82
treebd0eceaf7b88104e2ca105f089b85b8dd95fe19c
parent78c3f3305e173c7667ffb47b97ff0ecacc279fe5
RTS: Fix restrictive cast

Commit e75a9afd2989e0460f9b49fa07c1667299d93ee9 added an `unsigned` cast
to account for OSes that have signed `rlim_t` signed. Unfortunately,
the `unsigned` cast has the unintended effect of narrowing `rlim_t` to
only 4 bytes. This leads to some spurious out of memory crashes
(in particular: Haddock crashes with OOM whenn building docs of
`ghc`-the-library).

In this case, `W_` is a better type to cast to: we know it will be
unsigned too and it has the same type as `*len` (so we don't suffer from
accidental narrowing).
rts/posix/OSMem.c