#12709: GHC panic -------------------------------------+------------------------------------- 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: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I get {{{ $ ./ghc-stage2 -ignore-dot-ghci --interactive /tmp/tEZm.hs GHCi, version 8.1.20160930: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( /tmp/tEZm.hs, interpreted ) ghc-stage2: panic! (the 'impossible' happened) (GHC version 8.1.20160930 for x86_64-unknown-linux): kindPrimRep.go rep_a13E Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1076:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1080:37 in ghc:Outputable pprPanic, called at compiler/simplStg/RepType.hs:369:9 in ghc:RepType kindPrimRep, called at compiler/simplStg/RepType.hs:337:18 in ghc:RepType typePrimRep, called at compiler/ghci/ByteCodeGen.hs:1541:15 in ghc:ByteCodeGen Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
}}} running {{{#!hs {-# Language MagicHash, PolyKinds, ViewPatterns, TypeInType, RebindableSyntax, NoImplicitPrelude #-} import GHC.Types import Prelude hiding (Num (..)) import qualified Prelude as P import GHC.Prim data BoxUnbox = BUB Int Int# class Num (a :: TYPE rep) where (+) :: a -> a -> a fromInteger :: Integer -> a instance Num Int where (+) = (P.+) fromInteger = P.fromInteger instance Num Int# where (+) = (+#) fromInteger (fromInteger -> I# n) = n a :: BoxUnbox a = let u :: Num (a :: TYPE rep) => a u = 1 + 2 + 3 + 4 in BUB u u }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12709> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12709: GHC panic -------------------------------------+------------------------------------- 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: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): Btw this works, {{{#!hs data BoxUnbox = BUB Int Int# a :: (forall rep (a :: TYPE rep). Num a => a) -> BoxUnbox a u = BUB u u }}} as does this {{{#!hs b :: BoxUnbox b = do let u :: forall rep (a :: TYPE rep). Num a => a u = 24 BUB u u }}} and it looks like it fails on more complicated numerical equations {{{#!hs -- × × × FAILS × × × a_applied :: BoxUnbox a_applied = a (1 + 2 + 3) -- × × × FAILS × × × b' :: BoxUnbox b' = do let u :: forall rep (a :: TYPE rep). Num a => a u = 1 + 2 + 3 BUB u u }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12709#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12709: GHC panic -------------------------------------+------------------------------------- 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: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nfrisby): I don't know if it's exactly the same as this ticket, but I get a similar panic from the following minimization. {{{#!hs {-# Language TypeFamilies, TypeInType #-} import Data.Kind (Type) data U = U type family A (k :: Type) :: Type where A U = Type type family B (ty :: k) :: A k bad :: B 'U -> U bad _ = U }}} That gives the following panic when loaded in GHCi. {{{ ghc.exe: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-mingw32): kindPrimRep.go U }}} It does not panic when ''compiling'' with GHC. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12709#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12709: GHC panic -------------------------------------+------------------------------------- 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: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by nfrisby): * cc: nfrisby (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12709#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12709: GHC panic -------------------------------------+------------------------------------- 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: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => LevityPolymorphism Comment: We should rejec {{{ a :: BoxUnbox a = let u :: Num (a :: TYPE rep) => a u = 1 + 2 + 3 + 4 }}} because application `1 + blah` has a levity-polymorphic argument. See the paper. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12709#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12709: GHC panic -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) 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: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Richard Eisenberg <rae@…>): In [changeset:"dca44adb9e14992e0aed49cdfd4b2baa2182073b/ghc" dca44adb/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="dca44adb9e14992e0aed49cdfd4b2baa2182073b" Fix #12709 by not building bad applications In an effort to report multiple levity polymorphism errors all at once, the desugarer does not fail when encountering bad levity polymorphism. But we must be careful not to build the bad applications, lest they try to satisfy the let/app invariant and call isUnliftedType on a levity polymorphic type. This protects calls to mkCoreAppDs appropriately. test case: typecheck/should_fail/T12709 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12709#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12709: GHC panic -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | LevityPolymorphism Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_fail/T12709 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => merge * testcase: => typecheck/should_fail/T12709 * milestone: => 8.2.1 Comment: Please merge for 8.2. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12709#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12709: GHC panic -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: | LevityPolymorphism Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_fail/T12709 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.2` as ae6e63aa858d663952b67cc9969fd14782d307bb. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12709#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC