GHC 5.00 problem compiling Y Combinator

Simon Peyton-Jones simonpj at microsoft.com
Thu Aug 9 14:46:59 EDT 2001


It's an embarassing fact that you can make GHC's simplifier
loop using fixpoint data types in the way you do.  This is mentioned
in the 'Secrets of the GHC inliner' paper.   It's fixable, but
it's nuisance to fix, and would slightly slow up the compilation
of all programs, so we've never done it.  I havn't confirmed
for sure that this is what is happening to you, but I'm 
90% certain.

(Reason: GHC keeps inlining under control by not inlining
recursive functions -- but no functions here are recursive...)

Simon

| -----Original Message-----
| From: aleksey+ghc-bugs at cs.cmu.edu 
| [mailto:aleksey+ghc-bugs at cs.cmu.edu] 
| Sent: 02 August 2001 21:22
| To: glasgow-haskell-bugs at haskell.org
| Subject: Re: GHC 5.00 problem compiling Y Combinator 
| 
| 
| 
| Micahel Weber writes:
| > I am pretty much sure that we have a Debian package for 5.00.2 :)
| > 
| > 	http://packages.debian.org/unstable/devel/ghc5.html
| 
| okay, tried again with the 5.00.2 package; same behavior:
| 
|     Glasgow Haskell Compiler, Version 5.00.2, for Haskell 98, 
| compiled by GHC version 5.00.2
|     Using package config file: /usr/lib/ghc-5.00.2/package.conf
|     Hsc static flags: -static -fignore-interface-pragmas 
| -fomit-interface-pragmas -fdo-lambda-eta-expansion -flet-no-escape
|     *** Ineffective C pre-processor
|     echo '{-# LINE 1 "Y.hs" #-}' > /tmp/ghc6092.hspp && cat 
| Y.hs >> /tmp/ghc6092.hspp
| 
|     *** Checking old interface for hs = Just "Y.hs", hspp = 
| Just "/tmp/ghc6092.hspp":
|     Compiling Y                ( Y.hs, Y.o )
|     *** Parser:
|     *** Renamer:
|     *** Typechecker:
|     *** Desugar:
|         Result size = 76
|     *** Simplify:
|     Removing: /tmp/ghc6092.hspp
| 
| It gets stuck just after it prints "*** Simplify:" and 
| consumes all available memory until I hit Ctrl-C.
| 
| The file, again, is the following:
| 
| ---begin Y.hs---
| module Y
| (y, fact, factorial)
| where
| 
| data D a = D ((D a) -> a)
| 
| unD :: D a -> D a -> a
| unD (D g) = g
| 
| y :: ((a -> a) -> a -> a) -> a -> a
| y = \f -> let 
|           z = \g -> f ((unD g) g)
|           in
|           z (D z)
| 
| fact :: (Integer -> Integer) -> Integer -> Integer
| fact = \factt -> \x -> if (x == 0) then 1 else x * (factt (x-1))
| 
| factorial :: Integer -> Integer
| factorial = y fact
| ---end Y.hs---
| 
| -- 
| aleksey
| 
| _______________________________________________
| Glasgow-haskell-bugs mailing list 
| Glasgow-haskell-bugs at haskell.org 
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-bugs
| 




More information about the Glasgow-haskell-bugs mailing list