[GHC] #11723: TYPE 'UnboxedTupleRep is a lie

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.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: -------------------------------------+------------------------------------- From @RyanGlScott, comment:28:ticket:11471: I notice that there's a single constructor of `RuntimeRep` for unboxed tuples (`UnboxedTupleRep`). Does this mean something like this should be allowed? {{{#!hs {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} module Example where import Data.Typeable import GHC.Exts data Wat (a :: TYPE 'UnboxedTupleRep) = Wat a }}} Currently, that fails to compile due to a separate GHC panic: {{{ $ /opt/ghc/head/bin/ghc -O2 -fforce-recomp Example.hs [1 of 1] Compiling Example ( Example.hs, Example.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.1.20160317 for x86_64-unknown-linux): unboxed tuple PrimRep Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} But wouldn't this be dangerous anyway? After all, unboxed tuples are supposed to represent arguments on the stack, so couldn't unboxed tuple polymorphic potentially lead to the RTS miscalculating how much data to read? Or am I misreading this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.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 goldfire): You're absolutely right. Not only can we not have representation- polymorphic things, we can't have things -- other than plain unboxed tuples -- that have `UnboxedTupleRep`. Thanks for poking on this. Fix to come shortly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.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 RyanGlScott): Would it be sensible to just change the constructor to: {{{#!hs data RuntimeRep = ... | UnboxedTupleRep [RuntimeRep] }}} Or if we want to avoid conflating `Void#` and `UnboxedTupleRep []`, we could use `UnboxedtupleRep (NonEmpty RuntimeRep)`? That way, {{{#!hs typeOf (Proxy :: Proxy (# Int, Int #)) }}} would give {{{#!hs Proxy (TYPE ('UnboxedTupleRep '[PtrRepLifted, PtrRepLifted])) (# Int, Int #) }}} and thus have unambiguous size? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.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 goldfire): I thought of that. But GHC's current story around `PrimRep`s -- which is what the code generator uses -- keeps unboxed tuples entirely separate. So I think it's best to echo that here, too. Perhaps we can revisit this later. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.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 simonpj): * owner: => goldfire Comment: Sounds as though Richard is already working on a fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.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 simonpj): * priority: high => highest Comment: I'm going to make this 'highest' because Richard's fix sounds imminent. If not, is it a release blocker? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.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 goldfire): Imminent Imminent Yes Yes. Validating (again) right this very moment. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11723: TYPE 'UnboxedTupleRep is a lie
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: goldfire
Type: bug | Status: new
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version: 8.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 Richard Eisenberg

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: merge Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_fail/T11723 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => merge * testcase: => typecheck/should_fail/T11723 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11723: TYPE 'UnboxedTupleRep is a lie -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash | typecheck/should_fail/T11723 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * failure: None/Unknown => Compile-time crash * resolution: => fixed Comment: Merged as b3304e06554276593f91a8eedcb2490873cc50bc. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11723#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC