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

#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

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Seems to be a GHCi issue. Works ok when compiled. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12718: Segmentation fault, runtime representation polymorphism
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: GHCi crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): The patch does not cure the problem; but before the patch this program generated lots of spurious Lint errors. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): {{{ x2 :: T IntRep INt# }}} should be `Int#`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Yes, thanks, fixed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #12779 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * related: => #12779 Comment: This is because of #12779. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #12779 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): rwbarton pointed out in #12779 that argument of `isTrue#` should be `0#` or `1#`. The documentation also says the same thing in different words: {{{#!haskell {-# INLINE isTrue# #-} -- | Alias for 'tagToEnum#'. Returns True if its parameter is 1# and False -- if it is 0#. isTrue# :: Int# -> Bool -- See Note [Optimizing isTrue#] isTrue# x = tagToEnum# x }}} So maybe this is expected and we can close this ticket and #12779. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #12779 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): Replying to [comment:7 osa1]:
rwbarton pointed out in #12779 that argument of `isTrue#` should be `0#` or `1#`. ''[...]''
Liquid Haskell be like?? {{{#!hs isTrue# :: { v:Int# | v == 0# || v == 1# } -> Bool }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | LevityPolymorphism Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #12779 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => LevityPolymorphism -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12718: Segmentation fault, runtime representation polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: | LevityPolymorphism Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #12779 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => fixed Comment: I can't reproduce any more. Closing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12718#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC