simple program crash (GHC 5.02, Hugs)

Matthew Bentham [email protected]
Fri, 21 Dec 2001 22:40:38 +0000 (GMT)


On Fri, 21 Dec 2001, Oleg Galbert wrote:

> I'm a newbie in Haskell. 
> I tryed to compare performance of GHC compiled code and Ocaml compiled code
> on a small example:
> 
> test n cosx
>         | n==0 = cosx
>         | otherwise = test (n-1) (cosx+cos(cosx))
> 
> main = print ( test  10000000 0.0 )  
> 
> I compiled it on Win NT :
> 
> ghc -o test_haskell.exe test_haskell.hs
>      
> When I run the program I got the following message:
> 
> Stack space overflow: current size 1048576 bytes.
> Use `+RTS -Ksize' to increase it.
> 
> Hugs 98 (December 2001) version just fails with "Application Error" message.
> 
> Does a stack usage depends on number of recursive calls? Is there a tail
> recursion optimization?
> 
> In Ocaml version of this program everything goes well.
> The program produced the result without any complains.
> 
> Oleg Galbert
> 
> 
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 

-- 
Matthew Bentham, ART ltd., Mount Pleasant House, Cambridge CB3 ORN
Direct tel: +44 1223 578547

If this message is PGP signed, you may verify its signature with my
public key from http://www-stu.christs.cam.ac.uk/~mjb67/