[GHC] #11157: (Optimized prime generation) ghc: panic! (the 'impossible' happened)
GHC
ghc-devs at haskell.org
Wed Dec 2 21:44:54 UTC 2015
#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
More information about the ghc-tickets
mailing list