[GHC] #12489: undefined in view pattern inside pattern synonym causes GHC to panic
#12489: undefined in view pattern inside pattern synonym causes GHC to panic -------------------------------------+------------------------------------- Reporter: pkmx | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 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: -------------------------------------+------------------------------------- The following: {{{#!hs {-# LANGUAGE PatternSynonyms, ViewPatterns #-} pattern P :: a -> b pattern P a <- (undefined -> a) }}} causes GHC HEAD and 8.0.1 to panic: {{{ ghc: panic! (the 'impossible' happened) (GHC version 8.1.20160813 for x86_64-unknown-linux): StgCmmEnv: variable not found }}} Removing the pattern signature or moving `undefined` behind another name work however: {{{#!hs {-# LANGUAGE PatternSynonyms, ViewPatterns #-} bottom :: a bottom = undefined pattern P :: a -> b pattern P a <- (bottom -> a) -- OK! -- No type signature pattern P' a <- (undefined -> a) -- OK! }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12489> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12489: undefined in view pattern inside pattern synonym causes GHC to panic -------------------------------------+------------------------------------- Reporter: pkmx | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms 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 mpickering): * keywords: => PatternSynonyms -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12489#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12489: undefined in view pattern inside pattern synonym causes GHC to panic -------------------------------------+------------------------------------- Reporter: pkmx | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms 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 mpickering): This still happens in HEAD. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12489#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12489: undefined in view pattern inside pattern synonym causes GHC to panic -------------------------------------+------------------------------------- Reporter: pkmx | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms 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 Simon Peyton Jones <simonpj@…>): In [changeset:"f352e5cd7bb629fe0ca3b913bfbe7bee43d62f3a/ghc" f352e5c/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="f352e5cd7bb629fe0ca3b913bfbe7bee43d62f3a" Keep the bindings local during defaultCallStacks defaultCallStacks generates evidence bindings for call stacks, but wasn't setting the binding site correctly. As a result they were simply discarded in the case of pattern synonyms, giving rise to Trac #12489. The fix is easy; and I added an ASSERT to catch the error earlier. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12489#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12489: undefined in view pattern inside pattern synonym causes GHC to panic -------------------------------------+------------------------------------- Reporter: pkmx | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash | patsyn/should_compile/T12489 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * testcase: => patsyn/should_compile/T12489 * status: new => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12489#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12489: undefined in view pattern inside pattern synonym causes GHC to panic -------------------------------------+------------------------------------- Reporter: pkmx | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash | patsyn/should_compile/T12489 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"829b9682969a5dabd3a75b82864c48c2e6a19ee8/ghc" 829b9682/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="829b9682969a5dabd3a75b82864c48c2e6a19ee8" Keep the bindings local during defaultCallStacks defaultCallStacks generates evidence bindings for call stacks, but wasn't setting the binding site correctly. As a result they were simply discarded in the case of pattern synonyms, giving rise to Trac #12489. The fix is easy; and I added an ASSERT to catch the error earlier. (cherry picked from commit f352e5cd7bb629fe0ca3b913bfbe7bee43d62f3a) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12489#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12489: undefined in view pattern inside pattern synonym causes GHC to panic -------------------------------------+------------------------------------- Reporter: pkmx | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash | patsyn/should_compile/T12489 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * version: 8.1 => 8.0.1 * resolution: => fixed * milestone: => 8.0.2 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12489#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC