Hi,
I am running GHC 5.00 on an i586-linux machine (up-to-date Debian
"woody" distribution -- the GHC package is ghc5_5.00-1_i386.deb). The
machine has 64 megs of RAM and 64 meg swap.
soyuz:~$gcc --version
2.95.4
soyuz:~$ghc --version
The Glorious Glasgow Haskell Compilation System, version 5.00
Compiling the following file (Y.hs) produces the following output
(before I Ctrl-C the process) and eats up all available memory:
soyuz:~/haskell$ghc -v -C Y.hs
Glasgow Haskell Compiler, Version 5.00, for Haskell 98, compiled by GHC version
5.00
Using package config file: /usr/lib/ghc-5.00/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/ghc5006.hspp && cat Y.hs >> /tmp/ghc5006.hspp
*** Checking old interface for hs = Just "Y.hs", hspp = Just "/tmp/ghc5006.hspp":
Compiling Y ( Y.hs, Y.o )
*** Parser:
*** Renamer:
*** Typechecker:
*** Desugar:
Result size = 76
*** Simplify:
Removing: /tmp/ghc5006.hspp
Same behavior (consumes all memory) also happens with GHC 4.08.1
February Hugs98 is able to load and interpret the file correctly.
Obviously noone will write recursive functions in this manner; but
the compiler's behavior nonetheless strikes me as a bit strange.
Here is the file:
----begin Y.hs----
module Y
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----
Thanks
--
aleksey
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs