COMPLETE pragma causes compilation to hang forever under certain scenarios
This is a really bizarre one. If you have the following program:
{-# 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?
Trac metadata
Trac field | Value |
---|---|
Version | 8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | high |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | mpickering |
Operating system | |
Architecture |