id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
1186,GHC as a library panic on loading second module,ArthurVanLeeuwen,simonmar,"Given the following two modules:

{{{
module GHCLibTest where

import GHC
import PackageConfig
import DynFlags

main = do session <- newSession JustTypecheck (Just ""/usr/local/lib/ghc-6.6"")
          f <- getSessionDynFlags session
          f' <- parseDynamicFlags f [""-isrc"",""-ilib"",""-ilib/DData"",""-fglasgow-ex
ts"",""-package wx""]
          setSessionDynFlags session (fst f'){hscTarget = HscInterpreted}
          let preludeModule = mkModule (stringToPackageId ""base"") (mkModuleName
""Prelude"")
          setContext session [] [preludeModule]
          t <- guessTarget ""src/Main.hs"" Nothing
          addTarget session t
          load session LoadAllTargets
}}}

and


{{{
module OtherModule where

import Data.List

type Nummer = String

data Beademing = HFO | CPAP | IPPV | Geen       
    deriving (Show, Read, Eq)
data Bloeddruk = Hypertensie | Hypotensie | TensieNormaal       
    deriving (Show, Read, Eq)
data Partus = PartusTeVroeg | PartusNormaal     
    deriving (Show, Read, Eq)
}}}

the following results:


{{{
harlan:~/Werk/dss/software/ghclib arthurvl$ echo ""main"" | ghci -package ghc ghclibtest.hs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package readline-1.0 ... linking ... done.
Loading package unix-1.0 ... linking ... done.
Loading package Cabal-1.1.6 ... linking ... done.
Loading package regex-base-0.71 ... linking ... done.
Loading package regex-posix-0.71 ... linking ... done.
Loading package regex-compat-0.71 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package ghc-6.6 ... linking ... done.
[1 of 2] Compiling OtherModule      ( OtherModule.hs, interpreted )
[2 of 2] Compiling GHCLibTest       ( ghclibtest.hs, interpreted )
Ok, modules loaded: OtherModule, GHCLibTest.
*GHCLibTest> ghc-6.6: panic! (the 'impossible' happened)
  (GHC version 6.6 for powerpc-apple-darwin):
        lookup_dfun main:OtherModule.$f1{v r5ig} [lid]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

*GHCLibTest> Leaving GHCi.
harlan:~/Werk/dss/software/ghclib arthurvl$ 
}}}

This does not just occur for this recursive case, but
also for cases where the main module is from some
completely different program.",bug,closed,high,6.8.1,GHC API,6.6,fixed,,,Unknown/Multiple,powerpc,,Unknown,,,,
