[GHC] #9175: Bad interaction between Pattern Synonyms and Text
#9175: Bad interaction between Pattern Synonyms and Text -----------------------------------+--------------------------------------- Reporter: emertens | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time crash Unknown/Multiple | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | -----------------------------------+--------------------------------------- Compiling this file causes the impossible to happen. It is necessary to enable optimizations. The bug did not occur if the Text parameter was replaced with ByteString or String. {{{ {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE OverloadedStrings #-} module Bug where {- - Must compile with optimizations - - text-1.1.1.3 - ghc-7.8.2 - Both Darwin and Linux platforms - -} import Data.Text(Text) data T = C Text Bool f :: a -> b f _ = undefined {-# NOINLINE f #-} -- important pattern P1 a = C "sh" a -- at least two characters pattern P2 = C "x" True -- this pattern has to come last g :: Text -> T g x = case x of "" -> f (P1 undefined) -- this has to be a pattern synonym }}} {{{ [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) ghc: panic! (the 'impossible' happened) (GHC version 7.8.2 for x86_64-apple-darwin): StgCmmEnv: variable not found lvl_s2Jr{v} [lid] local binds for: main:Bug.f{v rBS} [gid] main:Bug.rewriteRule{v rBV} [gid] main:Bug.$mP2{v r17q} [gid] main:Bug.$WP2{v r17A} [gid] main:Bug.$mP1{v r17E} [gid] main:Bug.$WP1{v r17R} [gid] main:Bug.$WP3{v r3bq} [gid] main:Bug.$WP4{v r3ua} [gid] main:Bug.$WP5{v r3ub} [gid] main:Bug.$WP2_dt{v r3uc} [gid] main:Bug.$WP6{v r3ud} [gid] main:Bug.$WP7{v r3ue} [gid] main:Bug.$WP8{v r3uf} [gid] main:Bug.$w$mP1{v r3ug} [gid] main:Bug.$w$mP2{v r3uh} [gid] main:Bug.$mP3{v r3ui} [gid] main:Bug.$mP4{v r3uj} [gid] main:Bug.$mP5{v r3uk} [gid] main:Bug.$wrewriteRule{v r3ul} [gid] main:Bug.rewriteRule1{v r3um} [gid] main:Bug.rewriteRule2{v r3un} [gid] main:Bug.rewriteRule3{v r3uo} [gid] main:Bug.rewriteRule4{v r3up} [gid] main:Bug.rewriteRule5{v r3uq} [gid] lvl{v r3ur} [gid] Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9175> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9175: Bad interaction between Pattern Synonyms and Text ---------------------------------------+----------------------------------- Reporter: emertens | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"7ac600d5fcd74db1f991555de6e415030970d5f3/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="7ac600d5fcd74db1f991555de6e415030970d5f3" Make the matcher and wrapper Ids in PatSyn into LocalIds, not GlobalIds This was a serious bug, exposed by Trac #9175. The matcher and wrapper must be LocalIds, like record selectors and dictionary functions, for the reasons now documented in Note [Exported LocalIds] in Id.lhs In fixing this I found - PatSyn should have an Id inside it (apart from the wrapper and matcher) It should be a Name. Hence psId --> psName, with knock-on consequences - Tidying of PatSyns in TidyPgm was wrong - The keep-alive set in Desugar.deSugar (now) doesn't need pattern synonyms in it I also cleaned up the interface to PatSyn a little, so there's a tiny knock-on effect in Haddock; hence the haddock submodule update. It's very hard to make a test for this bug, so I haven't. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9175#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9175: Bad interaction between Pattern Synonyms and Text ---------------------------------------+----------------------------------- Reporter: emertens | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by simonpj): * status: new => merge Comment: Thank you for reporting this bug. It exposed a nasty bug in the pattern- synonym implementation, which I have now fixed. Nasty in that it's not easy to provoke... but I'm sure it would have bitten us soon enough. Indeed I'm not even going to add a test case. Please merge to 7.8.3 though (along with the corresponding Haddock patch. Thanks Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9175#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9175: Bad interaction between Pattern Synonyms and Text ---------------------------------------+----------------------------------- Reporter: emertens | Owner: Type: bug | Status: merge Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by thoughtpolice): * milestone: => 7.8.3 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9175#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9175: Bad interaction between Pattern Synonyms and Text ---------------------------------------+----------------------------------- Reporter: emertens | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9175#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC