Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,872
    • Issues 4,872
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 455
    • Merge requests 455
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13188
Closed
Open
Created Jan 26, 2017 by Ryan Scott@RyanGlScottMaintainer

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking