[GHC] #8573: "evacuate: strange closure type 0" when creating large array

#8573: "evacuate: strange closure type 0" when creating large array ----------------------------+---------------------------------- Reporter: nad | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | 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: 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; I have only tested using GHC 7.6.3. I am using base 4.6.0.1 and array 0.4.0.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8573 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8573: "evacuate: strange closure type 0" when creating large array ----------------------------------+--------------------------- Reporter: nad | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+--------------------------- Comment (by nad): 30000 should be 64988 (or vice versa). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8573#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8573: "evacuate: strange closure type 0" when creating large array ----------------------------------------+---------------------------- Reporter: nad | Owner: rwbarton Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ----------------------------------------+---------------------------- Changes (by rwbarton): * owner: => rwbarton Comment: Thanks for the report, I had this in my mental list of integer overflows to fix but hadn't created a ticket. Specifically, `stg_newArrayzh` (and all the other `new*Array` primops) need bounds-checking. Also see #229, but I regard that ticket as about integer overflows in the `array` package. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8573#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8573: "evacuate: strange closure type 0" when creating large array ----------------------------------------+---------------------------- Reporter: nad | Owner: rwbarton Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ----------------------------------------+---------------------------- Comment (by thomie): Is this a x86 problem only? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8573#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8573: "evacuate: strange closure type 0" when creating large array -------------------------------------+------------------------------------- Reporter: nad | Owner: rwbarton Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 7.6.3 System | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: Linux | Difficulty: Unknown Type of failure: Runtime | Blocked By: crash | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by rwbarton): * cc: simonmar (added) * component: Compiler => Runtime System * architecture: x86 => Unknown/Multiple Comment: No, it is not. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8573#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8573: "evacuate: strange closure type 0" when creating large array -------------------------------------+------------------------------------- Reporter: nad | Owner: rwbarton Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.6.3 Resolution: | Keywords: Operating System: Linux | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): With GHC HEAD I get, {{{ $ ghc --make hi.hs -O -main-is strangeClosureType [1 of 1] Compiling Main ( hi.hs, hi.o ) Linking hi ... $ ./hi 2111752566 hi: Out of memory }}} rwbarton, I suppose your thought was that the primop implementations should also do their own integer overflow checks? I'm not entirely convinced that is necessary. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8573#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC