Skip to content

"evacuate: strange closure type 0" when creating large array

Consider the following code:

module Main where

import Data.Array

xs :: [Int]
xs = [0 .. 64988]

crash :: Int -> IO ()
crash m = array (0, m) [ (x, x) | x <- xs ] `seq` return ()

strangeClosureType = do
  print (sum xs)
  crash (maxBound - 1)

segFault1 = crash (maxBound - 1)

segFault2 = do
  print (sum xs)
  crash (maxBound - 2)

If I compile the program using ghc --make Main.hs -O -main-is strangeClosureType, then I get the following error message:

Main: internal error: evacuate: strange closure type 0
    (GHC version 7.6.3 for i386_unknown_linux)
    Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Aborted (core dumped)

If I don't use -O, or if I let segFault1 or segFault2 be main, then I get the following error message instead:

Segmentation fault (core dumped)

If the number 30000 is replaced by some other number, then the strange closure error may be replaced by a segfault, or even no error at all.

Perhaps this is another instance of bug #7762 (closed); I have only tested using GHC 7.6.3.

I am using base 4.6.0.1 and array 0.4.0.1.

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