#5393: Segfault with unboxed arrays, unsafeAt, optimisations
----------------------------------------+-----------------------------------
Reporter: daniel.is.fischer | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 7.4.1
Component: Compiler (NCG) | Version: 7.0.4
Keywords: unsafeAt, optimisations | Testcase:
Blockedby: | Difficulty:
Os: Linux | Blocking:
Architecture: Unknown/Multiple | Failure: Runtime crash
----------------------------------------+-----------------------------------
Changes (by igloo):
* priority: normal => highest
* milestone: => 7.4.1
Comment:
Fantastic bug report, thanks! I made a fractionally shorter version while
looking at the core, but I think the problem is at a later phase:
{{{
import Data.Array.Unboxed
import Data.Array.Base
arr :: UArray Int Int
arr = listArray (0,4) [3,2,5,1,4]
fun :: Int -> Int
fun n = if n < 25 then unsafeAt arr 1 + unsafeAt arr (n `rem` 5)
else fun n
main :: IO ()
main = fun 5 `seq` return ()
}}}
I can reproduce the segfault with 6.12 and HEAD
{{{
$ ghc -O --make q && ./q
[1 of 1] Compiling Main ( q.hs, q.o )
Linking q ...
zsh: segmentation fault ./q
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5393#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs