Ticket #2787 (closed bug: duplicate)

Opened 5 years ago

Last modified 4 years ago

Panic (core lint failure) with type synonym in GHC 6.10.1

Reported by: BenMoseley Owned by: chak
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 6.10.1
Keywords: Cc: ben@…
Operating System: Unknown/Multiple Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

This causes a panic:

{-# LANGUAGE TypeFamilies, GADTs #-}
module GHCBug (
  PVR(..),
  Core(..),
  analyseCore
)
where

data Core a where Ctr :: Core Double
data PVR a = PVR a deriving (Eq, Show)


class Sub a where
    type AssocSyn a :: * -> *

instance Sub Double where
    type AssocSyn Double = PVR


analyseCore :: Core a -> ((AssocSyn a) a)
analyseCore Ctr = pvr
  where
    -- GHC panics if we use the below as the type sig for 'pvr'
    pvr :: PVR ~ AssocSyn a => (AssocSyn a) a
    -- pvr :: (AssocSyn a) a
    pvr = undefined

main :: IO ()
main = print "ok"

The basic compiler panic is:

c:/ws/main/depot/QA/EDG/EDG_priv/FPF_Dev.br/src $ ghc -main-is GHCBug ~/GHCBug.hs
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 6.10.1 for i386-unknown-mingw32):
	initC: srt_lbl

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

The core lint failure part is:

*** Checking old interface for main:GHCBug:
*** Parser:
*** Renamer/typechecker:
*** Desugar:
    Result size = 199
*** Core Lint Errors: in result of Desugar ***
{-# LINE 21 "F:\ME\GHCBug.hs #-}:
    [RHS of pvr_awa :: GHCBug.AssocSyn
                         GHC.Types.Double GHC.Types.Double]
    pvr_afN is out of scope
*** Offending Program ***

Attachments

ghcbug.txt Download (11.1 KB) - added by BenMoseley 5 years ago.
Full Output

Change History

Changed 5 years ago by BenMoseley

Full Output

Changed 5 years ago by chak

  • owner set to chak
  • os changed from Windows to Unknown/Multiple

Thanks for the bug report. In your code example, you could write

  ...
  where
     pvr :: PVR a
     pvr = undefined

That signature would be equivalent to the one that causes the panic.

I am just suggesting this as a possible work around until GHC has been fixed, but maybe it is only applicable to the stripped down example of your bug report.

Changed 5 years ago by BenMoseley

Thanks for the response. I've managed to work around it without too much trouble, so it's not directly urgent for us at the moment.

Changed 4 years ago by BenMoseley

  • cc ben@… added

Changed 4 years ago by simonpj

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to duplicate

Happily this seems to be fixed by the same fix as #2799, so I'll close this one. I won't add a test case, since I added one for #2799.

Simon

Note: See TracTickets for help on using tickets.