[GHC] #12718: Segmentation fault, runtime representation polymorphism

GHC ghc-devs at haskell.org
Sun Oct 16 17:48:51 UTC 2016


#12718: Segmentation fault, runtime representation polymorphism
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           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:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# Language RebindableSyntax, NoImplicitPrelude, MagicHash, RankNTypes,
 PolyKinds, ViewPatterns, TypeInType, FlexibleInstances #-}

 import Prelude hiding (Eq (..), Num(..))
 import qualified Prelude as P
 import GHC.Prim
 import GHC.Types

 class Num (a :: TYPE rep) where
   (+) :: a -> a -> a
   fromInteger :: Integer -> a

 instance P.Num a => Num a where
   (+) = (P.+)
   fromInteger = P.fromInteger

 instance Num Int# where (+) = (+#); fromInteger (fromInteger -> I# n) = n

 u :: Bool
 u = isTrue# v_ where
   v_ :: forall rep (a :: TYPE rep). Num a => a
   v_ = fromInteger 10
 }}}

 segfaults

 {{{#!hs
 $ ./bin/repo/ghc4/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci
 /tmp/tMjN.hs
 GHCi, version 8.1.20160930: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( /tmp/tMjN.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> u
 True
 *Main> Segmentation fault (core dumped)
 $
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12718>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list