I have a .hs file (enclosed) that defines some data structures, and
gives the following error:

   [marku@sally jaza]$ ghc -c GHCBug.hs
   hsc: fatal error: evacuate: strange closure type
   [marku@sally jaza]$ 

The error goes away when I comment out some of the data structures
(details are in the file itself below), or remove the 'deriving Read'.

I'm running the latest released version of GHC:
  The Glorious Glasgow Haskell Compilation System, version 4.02, patchlevel 0

The error is reported slightly differently when I run with -v:

[marku@sally jaza]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/specs
gcc version 2.7.2.3
[marku@sally jaza]$ ghc -v -c GHCBug.hs 
The Glorious Glasgow Haskell Compilation System, version 4.02, patchlevel 0

Effective command line: -v -c

Ineffective C pre-processor:
        echo '{-# LINE 1 "GHCBug.hs" -}' > /tmp/ghc1475.cpp && cat GHCBug.hs >> 
/tmp/ghc1475.cpp
0.00user 0.01system 0:00.01elapsed 52%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (81major+10minor)pagefaults 0swaps
ghc:compile:Output file GHCBug.o doesn't exist
ghc:compile:Interface file GHCBug.hi doesn't exist
ghc:recompile:Input file GHCBug.hs newer than GHCBug.o

Haskell compiler:
        /usr/local/lib/ghc-4.02/hsc ,-W ,/tmp/ghc1475.cpp  -fignore-interface-pragmas 
-fomit-interface-pragmas -fsimplify [  -ffloat-lets-exposing-whnf -ffloat-primops-ok 
-fcase-of-case -fdo-case-elim -freuse-con -fpedantic-bottoms 
-fmax-simplifier-iterations4  ]   -fwarn-overlapping-patterns -fwarn-missing-methods 
-fwarn-duplicate-exports -fhi-version=402 
-himap=.%.hi:/usr/local/lib/ghc-4.02/imports/std%.hi   -v -hifile=/tmp/ghc1475.hi 
-C=/tmp/ghc1475.hc -F=/tmp/ghc1475_stb.c -FH=/tmp/ghc1475_stb.h +RTS -H6000000 
-K1000000
Glasgow Haskell Compiler, version 4.02, for Haskell 98
EVACUATED object entered!
Command exited with non-zero status 1
4.01user 0.15system 0:04.52elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (1334major+1837minor)pagefaults 0swaps
deleting... /tmp/ghc1475.cpp /tmp/ghc1475.hi /tmp/ghc1475.hc /tmp/ghc1475_stb.c 
/tmp/ghc1475_stb.h

rm -f /tmp/ghc1475*
[marku@sally jaza]$ 


---------------------------------------------------------------------------
module GHCBug
--
-- $Id: AST.hs,v 1.22 1999/06/28 04:59:36 marku Exp $
--
-- This module defines Abstract Syntax Trees for Z terms
-- (expressions, predicates, schemas etc.).

-- NOTES ON GHC BUG:  When this file is compiled with GHC:
--
-- The Glorious Glasgow Haskell Compilation System, version 4.02, patchlevel 0
--
-- under Red Hat Linux release 5.2 (Apollo)  (Kernel 2.0.36 #1 i586)
-- it gives the following error:
--   [marku@sally jaza]$ ghc -c GHCBug.hs
--   hsc: fatal error: evacuate: strange closure type
--   [marku@sally jaza]$ 
--
-- but if you comment out the lines marked with (*), it compiles okay.
-- (Also the mutually recursive data structures seem to be important
--  E.g., the error also goes away when ZPred (and references to it)
--  is removed.  Similarly for ZBranch).
-- Finally, the error goes away if you remove all the 'deriving Read's.

where

type ZVar = (String, [ZDecor])
type ZDecor = String    
type ZInt = Int         

  
data ZGenFilt     
  = Include ZSExpr
  | Choose ZVar ZExpr
  | Check ZPred
  deriving (Eq,Ord,Read,Show)

data ZExpr
  = ZVar ZVar        
  | ZESchema ZSExpr     
  | ZInt ZInt           
  | ZCross [ZExpr]      
  | ZTuple [ZExpr]      
  | ZCall ZExpr ZExpr   
  | ZSetDisplay [ZExpr] 
  | ZSeqDisplay [ZExpr] 
  | ZBagDisplay [ZExpr] 
  | ZSetComp [ZGenFilt] (Maybe ZExpr)
  | ZLambda [ZGenFilt] ZExpr         
  | ZMu [ZGenFilt] (Maybe ZExpr)     
  | ZELet [(String,ZExpr)] ZExpr     
  | ZIf_Then_Else ZPred ZExpr ZExpr  
  | ZSelect ZExpr ZVar               
  | ZTheta ZSExpr                    
  | ZFSet [ZExpr]        
  | ZIntSet [ZInt] [ZInt]
  | ZPair ZExpr ZExpr    
  | ZBinding [(ZVar,ZValue)]
  | ZFree ZBranch           
  deriving (Eq,Ord,Read,Show)

type ZValue = ZExpr

data ZPred
  = ZFalse
  | ZTrue
  | ZPre ZSExpr
  | ZAnd ZPred ZPred
  | ZOr ZPred ZPred
  | ZImplies ZPred ZPred
  | ZIff ZPred ZPred
  | ZNot ZPred
  | ZExists [ZGenFilt] ZPred
  | ZExists_1 [ZGenFilt] ZPred
  | ZForall [ZGenFilt] ZPred
  | ZPLet [(String,ZExpr)] ZPred
  | ZEqual ZExpr ZExpr
  | ZMember ZExpr ZExpr
  | ZInRel ZVar ZExpr ZExpr
  | ZPreRel ZVar ZExpr
  | ZPSchema ZSExpr
  deriving (Eq,Ord,Read,Show)

data ZSExpr
  = ZSchema [ZGenFilt]
  | ZSRef ZSName [ZDecor] [ZReplace]
  | ZS1 ZS1 ZSExpr                     -- (*)
  | ZS2 ZS2 ZSExpr ZSExpr              -- (*)
  | ZSHide ZSExpr [ZVar]
  | ZSExists [ZGenFilt] ZSExpr
  | ZSExists_1 [ZGenFilt] ZSExpr 
  | ZSForall [ZGenFilt] ZSExpr
  deriving (Eq,Ord,Read,Show)

data ZS1                               -- (*)
  = ZSPre | ZSNot                      -- (*)
  deriving (Eq,Ord,Read,Show)          -- (*)

data ZS2                               -- (*)
  = ZSAnd | ZSOr | ZSImplies | ZSIff   -- (*)
  | ZSProject | ZSSemi | ZSPipe        -- (*)
  deriving (Eq,Ord,Read,Show)          -- (*)

data ZReplace
  = ZRename ZVar ZVar
  | ZAssign ZVar ZExpr
  deriving (Eq,Ord,Read,Show)

data ZSName
  = ZSPlain String | ZSDelta String | ZSXi String
  deriving (Eq,Ord,Read,Show)


data ZPara
  = ZGivenSetDecl String
  | ZSchemaDef ZSName ZSExpr
  | ZAbbreviation String ZExpr
  | ZFreeType String [ZBranch]
  | ZPredicate ZPred
  | ZAxDef [ZGenFilt]         
  | ZGenDef [ZGenFilt]        
  deriving (Eq,Ord,Read,Show)

data ZBranch
  = ZBranch String [ZExpr]
  deriving (Eq,Ord,Read,Show)


---------------------------------------------------------------------------

Mark.

Dr Mark Utting, Senior Lecturer
Department of Computer Science
School of Computing and Mathematical Sciences
The University of Waikato       Tel:   +64 7 838 4791
Private Bag 3105                Fax:   +64 7 838 4155
Hamilton                        Email: [EMAIL PROTECTED]
New Zealand                     Web:   http://www.cs.waikato.ac.nz/~marku

"The life of the Christian is a love affair."  [The Message]

Reply via email to