[GHC] #8184: Compiler panic in the presence of cyclic imports

GHC ghc-devs at haskell.org
Wed Aug 28 21:38:43 UTC 2013


#8184: Compiler panic in the presence of cyclic imports
---------------------------------------+-----------------------------------
        Reporter:  parcs               |            Owner:
            Type:  bug                 |           Status:  new
        Priority:  normal              |        Milestone:
       Component:  Compiler            |          Version:  7.7
      Resolution:                      |         Keywords:
Operating System:  Unknown/Multiple    |     Architecture:
 Type of failure:  Compile-time crash  |  Unknown/Multiple
       Test Case:                      |       Difficulty:  Unknown
        Blocking:  910                 |       Blocked By:
                                       |  Related Tickets:
---------------------------------------+-----------------------------------

Comment (by parcs):

 Digging deeper, the problem seems to be that in `WwLib.mkWWstr_one`,
 `deepSplitProductType_maybe y_type' returns `Nothing` when compiling `B`.
 But when compiling `C` (after re-typechecking the loop) it returns `Just
 y_datacon`.

 The immediate problem seem to lie in `WwLib.deepSplitProductType_maybe`:

 {{{
 #!haskell
 deepSplitProductType_maybe :: Type -> Maybe (DataCon, [Type], [Type],
 Coercion)
 deepSplitProductType_maybe ty
   | let (ty1, co) = topNormaliseNewType ty `orElse` (ty, mkReflCo
 Representational ty)
   , Just (tc, tc_args) <- splitTyConApp_maybe ty1
   , Just con <- isDataProductTyCon_maybe tc
   -- ^ This pattern fails for Y when compiling A.hs (because Y looks empty
 then)
   -- and succeeds when compiling C (because the import loop has been
   -- re-typechecked by then). This discrepancy causes `WwLib.mkWWstr_one`
 to
   -- return a different worker type depending on whether one is compiling
   -- a module inside the loop or outside the loop.
   = Just (con, tc_args, dataConInstArgTys con tc_args, co)
 deepSplitProductType_maybe _ = Nothing
 }}}

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




More information about the ghc-tickets mailing list