[GHC] #14051: Unboxed sums-related panic: getUnboxedSumName 513

#14051: Unboxed sums-related panic: getUnboxedSumName 513 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Keywords: UnboxedSums | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Originally reported [https://www.reddit.com/r/haskell/comments/6q6yau/unboxed_sums_ghc_panic/ here]. You'll need these two files: {{{#!hs -- Testing.hs {-# LANGUAGE UnboxedSums #-} module Testing where func :: s -> (# Bool | Bool #) func _ = (# True | #) }}} {{{#!hs -- Bug.hs {-# LANGUAGE UnboxedSums #-} module Main where import Testing main :: IO () main = print $ func 1 }}} And you must compile them like so (the `-c` and `-O2` flags are important): {{{ $ ghc -O2 -c Testing.hs $ ghc -O2 -c Bug.hs ghc: panic! (the 'impossible' happened) (GHC version 8.2.1 for x86_64-unknown-linux): getUnboxedSumName 513 Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable pprPanic, called at compiler/prelude/KnownUniques.hs:104:5 in ghc:KnownUniques }}} Reproducible with GHC 8.2.1 and HEAD. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14051 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14051: Unboxed sums-related panic: getUnboxedSumName 513 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1-rc2 checker) | Resolution: | Keywords: UnboxedSums Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * cc: dfeuer (added) * failure: None/Unknown => GHC accepts invalid program * component: Compiler => Compiler (Type checker) Comment: If I understand things correctly, the type checker should refuse to `print` a `(# Bool | Bool #)`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14051#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14051: Unboxed sums-related panic: getUnboxedSumName 513 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: UnboxedSums 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 RyanGlScott): * cc: bgamari (added) * failure: GHC accepts invalid program => None/Unknown * component: Compiler (Type checker) => Compiler Comment: The fact that the code in `Main` doesn't typecheck is unimportant, since you can also trigger the panic with this code that does typecheck: {{{#!hs -- Bug.hs {-# LANGUAGE UnboxedSums #-} module Main where import Testing main :: IO () main = print $ case func () of (# True | #) -> 123 _ -> 321 }}} cc'ing Ben, who wrote the `getUnboxedSumName` function in 34d933d6a821edf5abfcbee76d9325362fc28a13. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14051#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14051: Unboxed sums-related panic: getUnboxedSumName 513 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: UnboxedSums 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 bgamari): * priority: normal => highest * owner: (none) => bgamari * milestone: => 8.2.2 Comment: Thanks for the report! I'm on it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14051#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14051: Unboxed sums-related panic: getUnboxedSumName 513 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: bgamari Type: bug | Status: patch Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: UnboxedSums Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3805 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D3805 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14051#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14051: Unboxed sums-related panic: getUnboxedSumName 513
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: bgamari
Type: bug | Status: patch
Priority: highest | Milestone: 8.2.2
Component: Compiler | Version: 8.2.1-rc2
Resolution: | Keywords: UnboxedSums
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3805
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#14051: Unboxed sums-related panic: getUnboxedSumName 513 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: bgamari Type: bug | Status: merge Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: UnboxedSums Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | unboxedsums/T14051 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3805 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => unboxedsums/T14051 * status: patch => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14051#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14051: Unboxed sums-related panic: getUnboxedSumName 513 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: bgamari Type: bug | Status: closed Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | Keywords: UnboxedSums Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | unboxedsums/T14051 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3805 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.2` with fe5350561dccb1913c2bdde2cd76d5513350b2cf. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14051#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC