[GHC] #13188: COMPLETE pragma causes compilation to hang forever under certain scenarios

GHC ghc-devs at haskell.org
Thu Jan 26 20:12:18 UTC 2017


#13188: COMPLETE pragma causes compilation to hang forever under certain scenarios
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:  8.2.1
          Component:  Compiler       |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
  PatternSynonyms                    |
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  performance bug
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This is a really bizarre one. If you have the following program:

 {{{#!hs
 {-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE ViewPatterns #-}
 module Main where

 class LL f where
   go :: f a -> ()

 instance LL [] where
   go _ = ()

 pattern GoLL :: LL f => f a
 pattern GoLL <- (go -> ())

 {-# COMPLETE GoLL :: [] #-}

 goLLEx :: [a] -> Int
 goLLEx GoLL = 5

 main :: IO ()
 main = return ()
 }}}

 And you compile it with GHC HEAD in just the right way, GHC hangs forever!

 {{{
 $ ~/Software/ghc3/inplace/bin/ghc-stage2 -no-link Bug.hs
 [1 of 1] Compiling Main             ( Bug.hs, Bug.o )
 $ ~/Software/ghc3/inplace/bin/ghc-stage2 Bug.hs
 # Hangs forever here
 }}}

 That `-no-link` part is crucial, since if you compile it straight from a
 source file, it works. Also worth noting:

 * I can reproduce this in GHC HEAD, but not in GHC 8.0.2.
 * The `COMPLETE` pragma is critical for triggering this bug. If you
 comment it out, then the issue disappears.

 Note that `cabal-install` installs executables using this `-no-link`
 strategy, so this bug effectively prevents me from using `cabal-install`
 with code that involves `COMPLETE` pragmas. Marking as high priority.

 I have //no// idea where to start looking for this one. Matthew, do you
 have any idea what might be happening here?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13188>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list