C stack overflow (was: (no subject))

Sigbjorn Finne sof@galois.com
Wed, 9 Jan 2002 15:22:23 -0800


Hi,

you don't say what version of Hugs you're using, nor on
what platform, but when I run your repro code with the
Dec 2001 release on a Win2k box, the garbage collector
runs out of heap space & complains.

There are programs (and heap sizes) for which the garbage
collector will blow the C stack, resulting in the kind of 'crash'
which I believe you're experiencing. The Dec 2001 release did
reduce the likelihood of that happening, so if you're not using it,
I'd encourage you to pick it up.

hth
--sigbjorn

----- Original Message -----
From: <joosten@Anaxagoras.com>
To: <hugs-bugs@haskell.org>
Sent: Friday, January 04, 2002 02:47
Subject: (no subject)


> I have performed research with Hugs quite a lot, and this is the first
time
> I have run into a real bug. I have isolated the bug into the following
> program, which brings the Hugs interpreter down. Since an interpreter
> should be something that never "crashes" (it should generate error
messages
> instead), I conclude that this must be a bug. Here is the program
>
> >  testCycles rs = (paths, map shrink cycles)
> >   where
> >    shrink cycles     = dropWhile (/=last cycles) cycles
> >    (paths, cycles)   = f (rd[[a]| (a,b)<-rs, not (a `elem` map snd rs)],
> [])
> >    f (paths,cs)
> >     | null paths'    = (paths,cs)
> >     | otherwise      = f (paths++paths',cs++paths'')
> >                        where
> >                         paths'  = rd[pth++[b]|pth<-paths, (a,b)<-rs,
last
> pth==a, not (b `elem` pth)]
> >                         paths'' = rd[pth++[b]|pth<-paths, (a,b)<-rs,
last
> pth==a,      b `elem` pth ]
>
> >  rd [] = []
> >  rd (x:xs) = x: rd [e|e<-xs, e/=x]
>
> It crashes when executed. Try for example the expression:
>
> testCycles [(1,4),(4,5),(7,8),(3,2),(2,7)]
>
>
> Yours,
> Stef Joosten
>