
#12520: Segfault when using unboxed tuples in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHCi crash Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If you put this module in a package: {{{#!hs {-# LANGUAGE MagicHash, UnboxedTuples #-} module Bug ( box, wrap, proxy ) where import GHC.Prim box :: (# Proxy# a, b #) -> b box (# x, y #) = y wrap :: b -> Proxy# a -> (# Proxy# a, b #) wrap x = \i# -> (# i#, x #) proxy :: () -> Proxy# a proxy () = proxy# }}} Then in GHCi you can do: {{{ GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> import Bug Prelude Bug> box (wrap "foo" (proxy ())) "Segmentation fault (core dumped) }}} Alternatively you can crash `runhaskell` if you put the above code in main. It seems that GHCi fails to pickup usage of (# VoidRep, PtrLiftedRep #) tuples or something. The same trick works with `State#` in place of `Proxy#`, but not with `Int#`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12520 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler