[GHC] #11311: segmentation fault/panic with -XTypeInType and functions of type * -> *

#11311: segmentation fault/panic with -XTypeInType and functions of type * -> * -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 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: -------------------------------------+------------------------------------- Since `* :: *`, I can specialize a function of type `a -> a` to type `* -> *`. This seems like potentially not a great idea, and GHCi agrees: {{{ rwbarton@morphism:/tmp$ ~/ghc-newest/inplace/bin/ghc-stage2 --interactive GHCi, version 7.11.20151228: http://www.haskell.org/ghc/ :? for help Prelude> :set -XTypeInType Prelude> import Data.Kind Prelude Data.Kind> :t id :: * -> * id :: * -> * :: * -> * Prelude Data.Kind> (id :: * -> *) undefined `seq` () Segmentation fault }}} Also, when compiling a module containing the above expression, I get a panic while producing Cmm: {{{ rwbarton@morphism:/tmp$ ~/ghc-newest/inplace/bin/ghc-stage2 t [1 of 1] Compiling Main ( t.hs, t.o ) ghc-stage2: panic! (the 'impossible' happened) (GHC version 7.11.20151228 for x86_64-unknown-linux): idToReg sat_sKV }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11311 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11311: segmentation fault/panic with -XTypeInType and functions of type * -> * -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 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 rwbarton): Apparently I don't really have to `:set -XTypeInType` to do this. It's enough to `import Data.Kind`. Is that intentional? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11311#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11311: segmentation fault/panic with -XTypeInType and functions of type * -> * -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * failure: None/Unknown => Compile-time crash -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11311#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11311: segmentation fault/panic with -XTypeInType and functions of type * -> * -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): There should be nothing wrong with specializing `id` to `* -> *`. `*` is a perfectly fine type that is uninhabited by terms. But clearly some part of GHC expects things of type `*` to be types. I will investigate. As for comment:1 : It would be nice to reject this without `-XTypeInType`, but arranging to snag all the things that used to be impossible is quite hard and would be rather invasive in GHC. With Simon's consultation, we decided to snag just the easy cases. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11311#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11311: segmentation fault/panic with -XTypeInType and functions of type * -> *
-------------------------------------+-------------------------------------
Reporter: rwbarton | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#11311: segmentation fault/panic with -XTypeInType and functions of type * -> * -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash | dependent/should_compile/T11311 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => merge * testcase: => dependent/should_compile/T11311 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11311#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11311: segmentation fault/panic with -XTypeInType and functions of type * -> * -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash | dependent/should_compile/T11311 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed * milestone: => 8.0.1 Comment: Cherry-picked to `ghc-8.0` as 7e58aa08be2e58d0748c89fe7fad2c0961a35083. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11311#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC