[Git][ghc/ghc][master] osReserveHeapMemory: handle signed rlim_t
Marge Bot
gitlab at gitlab.haskell.org
Tue Apr 23 13:33:35 UTC 2019
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
6a491726 by Fraser Tweedale at 2019-04-23T13:27:30Z
osReserveHeapMemory: handle signed rlim_t
rlim_t is a signed type on FreeBSD, and the build fails with a
sign-compare error. Add explicit (unsigned) cast to handle this
case.
- - - - -
1 changed file:
- rts/posix/OSMem.c
Changes:
=====================================
rts/posix/OSMem.c
=====================================
@@ -546,10 +546,12 @@ void *osReserveHeapMemory(void *startAddressPtr, W_ *len)
#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H)
struct rlimit limit;
+ /* rlim_t is signed on some platforms, including FreeBSD;
+ * explicitly cast to avoid sign compare error */
if (!getrlimit(RLIMIT_AS, &limit)
&& limit.rlim_cur > 0
- && *len > limit.rlim_cur) {
- *len = limit.rlim_cur;
+ && *len > (unsigned) limit.rlim_cur) {
+ *len = (unsigned) limit.rlim_cur;
}
#endif
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/6a491726bbe000c4b0effc4175caaaabc7416f1e
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/6a491726bbe000c4b0effc4175caaaabc7416f1e
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/20190423/046a84cc/attachment.html>
More information about the ghc-commits
mailing list