[GHC] #811: GHC panics when compiling some mutually recursive modules that export something imported

GHC trac at galois.com
Tue Jul 4 11:56:44 EDT 2006


#811: GHC panics when compiling some mutually recursive modules that export
something imported
-------------------------+--------------------------------------------------
    Reporter:  guest     |        Owner:         
        Type:  bug       |       Status:  new    
    Priority:  normal    |    Milestone:         
   Component:  Compiler  |      Version:  6.4.2  
    Severity:  critical  |     Keywords:         
          Os:  Linux     |   Difficulty:  Unknown
Architecture:  powerpc   |  
-------------------------+--------------------------------------------------
This happened in my own code, and then I reduced it to a much simpler
 test-case.  I wished to try it in another compiler, if only to make doubly
 sure that it is correct code, but I couldn't get any to work with (these)
 mutually recursive modules (for a variety of reasons).  So, unless I am
 quite mistaken, I am unable to compile my Haskell-98 program at this
 point.

 Following are the four files to cause the error, then the command to
 invoke GHC (6.4.2, but 6.4.1 also failed for me in the same way) and the
 result.

 !CausesRecursiveModules.hs:
 {{{
 --This module is what makes MainBug need a .hs-boot file.

 module CausesRecursiveModules () where
 import {-# SOURCE #-} MainBug ()
 }}}

 !ExportsSomething.hs:
 {{{
 -- This module by itself triggers no bug, but is necessary
 -- as something for MainBug to externally import.
 -- "Something" triggers the bug at least whether it's a thing,
 -- a type-alias, or a data definition (with the appropriate
 -- capitalization for each). (I tested those, as can be seen
 -- in the commented code below.)

 module ExportsSomething (Something) where
 type Something = ()
 --data Something = MkSomething
 --something :: (); something = undefined
 }}}

 !MainBug.hs:
 {{{
 --The export of "Something" here is necessary to trigger the bug,
 --  as well as it being externally imported.
 --(Actually the bug still happens if "Something" is not exported
 --  here and module ExportsSomething is not imported here at all,
 --  but that violates the expectation that the .hs-boot file
 --  should be a subset of the main .hs file.)
 --Importing CausesRecursiveModules here is necessary
 --  to cause recursive modules.
 --Rather than import ExportsSomething, it also triggers the bug to re-
 export
 --  something from the Prelude, such as 'id'; as it is, though, the bug
 --  still happens with -fno-implicit-prelude.

 module MainBug (Something) where
 import ExportsSomething (Something)
 import CausesRecursiveModules ()
 }}}

 !MainBug.hs-boot:
 {{{
 --The export of "Something" here is necessary to trigger the bug,
 --  as well as it being externally imported.
 --Note that "Something" is not actually and does not need to actually
 --  be imported by anyone from module MainBug (although the bug still
 happens
 --  if it is; it's just not the simplest test-case then!)
 --Rather than import ExportsSomething, it also triggers the bug to re-
 export
 --  something from the Prelude, such as 'id'; as it is, though, the bug
 --  still happens with -fno-implicit-prelude.

 module MainBug (Something) where
 import ExportsSomething (Something)
 }}}
 I've uploaded those four files at
 http://isaac.cedarswampstudios.org/2006/GHC6.4.2RecursiveModulesBug.tar.gz
 for convenience.

 This is the exact command and result to reproduce the bug, although
 variations on command-line arguments as well as trying to compile
 !CausesRecursiveModules.hs instead all seem to produce about the same
 error. I didn't try figuring out how to do it without --make, though.

 {{{
 $ ghc --make MainBug.hs
 Chasing modules from: MainBug.hs
 Compiling ExportsSomething ( ./ExportsSomething.hs, ./ExportsSomething.o )
 Compiling MainBug[boot]    ( MainBug.hs-boot, MainBug.o-boot )
 Compiling CausesRecursiveModules ( ./CausesRecursiveModules.hs,
 ./CausesRecursiveModules.o )
 Compiling MainBug          ( MainBug.hs, MainBug.o )
 ghc-6.4.2: panic! (the `impossible' happened, GHC version 6.4.2):
         checkHiBootIface MainBug.Something{tc r18N}
 }}}

 -- Isaac Dupree

 P.S. In case licenses matter, I hereby put this post/ticket/whatever-it-
 is, and the .tar.gz, into the public domain.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/811>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list