Skip to content

GHCi bug: bus error when executing some gsl-random code

When compiling this simple program, the resulting executable runs fine, while running it under ghci causes a crash. It's gsl-random related obviously, but the difference in behaviour between plain ghc and ghci is somewhat odd.

$ cat a.hs
import Control.Monad
import Control.Monad.MC
import Control.Monad.MC.Class
import GHC.Word

seed = 57
buildRow el l = (sampleSubset el l [1..]) `evalMC` (mt19937 seed)

main = do
        mapM_ putStrLn (map show ((buildRow 2 10) :: [Double]))

$ ghc --make a.hs
[1 of 1] Compiling Main             ( a.hs, a.o )
Linking a ...
$ ./a 
1.0
6.0
$ ghci a.hs 
GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Ok, modules loaded: Main.
Prelude Main> main
Loading package syb ... linking ... done.
Loading package base-3.0.3.0 ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package gsl-random-0.2.3 ... linking ... done.
Loading package uvector-0.1.0.3 ... linking ... done.
Loading package monte-carlo-0.2 ... linking ... done.
zsh: bus error  ghci a.hs
Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by fdeweerdt
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information