Opened 5 months ago

Last modified 5 months ago

#8573 new bug

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

Reported by: nad Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.3
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: Runtime crash Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:


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:
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; I have only tested using GHC 7.6.3.

I am using base and array

Change History (1)

comment:1 Changed 5 months ago by nad

30000 should be 64988 (or vice versa).

Note: See TracTickets for help on using tickets.