Skip to content

64 bit windows executables compiled with ghc-7.8rc2 segfault when allocate more than 4G of memory

Consider this:

-- t.hs
import System.Environment

main :: IO ()
main = do
   n <- fmap (read . head) getArgs
   print $ foldr (+) (0::Int) [0 .. n]

Compiled with ghc-7.6.3 and ran thus:

ghc -O2 -rtsopts --make -o t.exe t.hs

t.exe +RTS -K4G -RTS 250000000

it works fine!

But compiled with 7.8rc2 it segfaults when amount of memory allocated crosses 4G mark.

I've discovered this trying to use Agda built with ghc-7.8rc2 but quickly understood this is a general problem and extremely nasty one.

Trac metadata
Trac field Value
Version 7.8.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority highest
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC simonmar
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information