Opened 9 years ago

Closed 9 years ago

Last modified 3 years ago

#4003 closed bug (fixed)

tcIfaceGlobal panic building HEAD with 6.12.2

Reported by: simonmar Owned by: igloo
Priority: highest Milestone: 6.12.3
Component: Compiler Version: 6.12.2
Keywords: hs-boot Cc: pho@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case: T4003
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

This is bad, because we can't build HEAD with the newly released 6.12.2. It was reported a few days ago by Matthias Kilian on cvs-ghc, but at the time we didn't realise it was a regression in 6.12.2.

ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.2 for x86_64-unknown-linux):
        tcIfaceGlobal (local): not found:
    ghc-6.13:HsExpr.$fxDataHsExpr{v rlO}
    [(a2NS, Identifier `ic{v a2NS}'), (a2O9, Identifier `ic{v a2O9}'),
     (a2Ol, Identifier `ic{v a2Ol}'), (a2OD, Identifier `ic{v a2OD}'),
     (a2OO, Identifier `ic{v a2OO}'), (a2Pj, Identifier `ic{v a2Pj}'),
     (a2Px, Identifier `ic{v a2Px}'), (a2PK, Identifier `ic{v a2PK}'),
     (a2Q6, Identifier `ic{v a2Q6}'), (a2Sf, Identifier `ic{v a2Sf}'),
     (a2Te, Identifier `ic{v a2Te}'), (a2UJ, Identifier `ic{v a2UJ}'),
     (a2WH, Identifier `ic{v a2WH}'), (a35p, Identifier `ic{v a35p}'),
     (a363, Identifier `typeOf1{v a363}'),
     -- more follows

Unpulling this patch in the HEAD tree allegedly avoids the bug:

Mon Mar 29 18:10:20 PDT 2010  David Waern <david.waern@gmail.com>
  * Add Data and Typeable instances to HsSyn

Change History (5)

comment:1 Changed 9 years ago by igloo

Testcase:

HsExpr.hs-boot:

module HsExpr where

import Data.Data

data HsExpr i

instance Data i => Data (HsExpr i)

HsLit.hs:

{-# LANGUAGE DeriveDataTypeable #-}

module HsLit where

import {-# SOURCE #-} HsExpr( HsExpr )

import Data.Data

data HsLit = HsChar
  deriving (Data, Typeable)

data HsOverLit id
  = OverLit (HsExpr id)
  deriving (Data, Typeable)

data OverLitVal = HsIntegral
  deriving (Data, Typeable)

HsExpr.hs:

{-# LANGUAGE DeriveDataTypeable #-}

module HsExpr where

import HsLit

import Data.Data

data MyId = MyId
    deriving (Data, Typeable)

data HsExpr id
  = HsOverLit (HsOverLit id)
  | HsBracketOut (HsExpr MyId)
  deriving (Data, Typeable)
$ ghc -O -c HsExpr.hs-boot
$ ghc -O -c HsLit.hs
$ ghc -O -c HsExpr.hs
ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.2 for x86_64-unknown-linux):
        tcIfaceGlobal (local): not found:
    main:HsExpr.$fxDataHsExpr{v r3C}
    [(ayP, Identifier `typeOf1{v ayP}'),
     (ayV, Identifier `typeOf{v ayV}'),
     (azj, Identifier `gfoldl{v azj}'), (azo, Identifier `ic{v azo}'),
     (azK, Identifier `gunfold{v azK}'), (azP, Identifier `ic{v azP}'),
     (azT, Identifier `toConstr{v azT}'),
     (azZ, Identifier `dataTypeOf{v azZ}'),
     (aAS, Identifier `dataCast1{v aAS}'),
     (aCH, Identifier `gfoldl{v aCH}'),
     (aCM, Identifier `gunfold{v aCM}'),
     (aCQ, Identifier `toConstr{v aCQ}'),
     (aCU, Identifier `dataTypeOf{v aCU}'),
     (r3D, Type constructor `main:HsExpr.HsExpr{tc r3D}'),
     (rsH, Data constructor `main:HsExpr.HsBracketOut{d rsH}'),
     (rsJ, Data constructor `main:HsExpr.HsOverLit{d rsJ}'),
     (rsL, Type constructor `main:HsExpr.MyId{tc rsL}'),
     (rsN, Data constructor `main:HsExpr.MyId{d rsN}'),
     (rsX, Identifier `main:HsExpr.HsOverLit{v rsX}'),
     (rt0, Identifier `main:HsExpr.HsBracketOut{v rt0}'),
     (rt3, Identifier `main:HsExpr.MyId{v rt3}'),
     (rwZ, Identifier `main:HsExpr.$fDataHsExpr{v rwZ}'),
     (rx3, Identifier `main:HsExpr.$fTypeable1HsExpr{v rx3}'),
     (rx6, Identifier `main:HsExpr.$fTypeableMyId{v rx6}'),
     (rx7, Identifier `main:HsExpr.$fDataMyId{v rx7}'),
     (rxB, Identifier `main:HsExpr.$cMyId{v rxB}'),
     (rxD, Identifier `main:HsExpr.$tMyId{v rxD}'),
     (rxF, Identifier `main:HsExpr.$cHsBracketOut{v rxF}'),
     (rxH, Identifier `main:HsExpr.$cHsOverLit{v rxH}'),
     (rxJ, Identifier `main:HsExpr.$tHsExpr{v rxJ}')]

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

comment:2 Changed 9 years ago by PHO

Cc: pho@… added

comment:3 Changed 9 years ago by simonpj

Owner: set to igloo

This turned out to be an oversight which happened, I think, when I was careless when refactoring some code in TcRnDriver. We need dictionary functions from a hs-boot file to be available when looking at unfoldings in interface files.

It is fixed by two patches. One for the HEAD

Tue May 11 00:50:26 PDT 2010  simonpj@microsoft.com
  * Fix Trac #4003: fix the knot-tying in checkHiBootIface
 
  I had incorrectly "optimised" checkHiBootIface so that it forgot
  to update the "knot-tied" type environment.
 
  This patch fixes the HEAD

    M ./compiler/ghc.mk -7
    M ./compiler/typecheck/TcRnDriver.lhs -7 +11}}}

and one for 6.12:

Mon May 10 06:56:06 PDT 2010  simonpj@microsoft.com
  * Fix Trac #4003: update the knot-tied type environment with boot dfuns

Ian, I wonder if you might turn your excellent test case into a testsuite test? I think you'll need separate compilation to show the bug.

Thanks

Simon

comment:4 Changed 9 years ago by igloo

Resolution: fixed
Status: newclosed
Test Case: T4003

Test added

comment:5 Changed 3 years ago by ezyang

Keywords: hs-boot added
Note: See TracTickets for help on using tickets.