8 Sep
2005
8 Sep
'05
4:53 p.m.
On Thu, Sep 08, 2005 at 04:00:47PM +0000, fool@sdf-eu.org wrote:
$ cat bug.hs main = print (let (x,(q,_)) = (1,divMod x x) in q) $ runhugs bug.hs Illegal instruction (core dumped)
Not entirely innocent: demand for x also causes evaluation of the second pair, which depends on x: an infinite loop. The correct version is main = print (let (x,~(q,_)) = (1,divMod x x) in q) Unfortunately, it's a known bug that some infinite loops cause Hugs to overrun the C stack, crashing the program. (This is caught under Windows, but not Unix.)