[GHC] #11157: (Optimized prime generation) ghc: panic! (the 'impossible' happened)

#11157: (Optimized prime generation) ghc: panic! (the 'impossible' happened) -------------------------------------+------------------------------------- Reporter: jachymb | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Linux Architecture: x86_64 | Type of failure: Compile-time (amd64) | crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I try to compile the example from https://wiki.haskell.org/Prime_numbers#Using_ST_Array {{{#!hs {-# OPTIONS_GHC -O2 #-} import Control.Monad import Control.Monad.ST import Data.Array.ST import Data.Array.Unboxed sieveUA :: Int -> UArray Int Bool sieveUA top = runSTUArray $ do let m = (top-1) `div` 2 r = floor . sqrt $ fromIntegral top + 1 sieve <- newArray (1,m) True -- :: ST s (STUArray s Int Bool) forM_ [1..r `div` 2] $ \i -> do isPrime <- readArray sieve i when isPrime $ do -- ((2*i+1)^2-1)`div`2 == 2*i*(i+1) forM_ [2*i*(i+1), 2*i*(i+2)+1..m] $ \j -> do writeArray sieve j False return sieve }}} I get the following error: {{{ [1 of 1] Compiling Main ( p111.hs, interpreted ) ghc: panic! (the 'impossible' happened) (GHC version 7.10.2 for x86_64-unknown-linux): floatExpr tick break<29>() Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} The error does not happen if I remove the OPTIONS_GHC -O2 directive. I use ArchLinux and the GHC compiled package from it's standard repositories. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11157 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11157: (Optimized prime generation) ghc: panic! (the 'impossible' happened) -------------------------------------+------------------------------------- Reporter: jachymb | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Perhaps a dup of #10549, #10948? Try with 7.10.3? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11157#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11157: (Optimized prime generation) ghc: panic! (the 'impossible' happened) -------------------------------------+------------------------------------- Reporter: jachymb | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => duplicate Comment: I'm assuming you are loading this in GHCi. The workaround is to remove the {-# OPTIONS_GHC -O2 #-} from your file. Indeed fixed in 7.10.3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11157#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC