The following behaviour of infinite recursion seems exaggerated: script test.hs contains only undef :: Int->Int undef x = undef x + 1
:l test :t undef undef:: Int->Int undef 1 Segmentation fault
Shouldn't this rather run into an infinite loop or a memory overflow. But segmentation fault? Best, Bernhard
Yes, this is by no means an ideal situation. The reduction of the function application below causes the C stack to be blown. In the absence of a portable way of detecting C stack overflows, the interpreter is unable to detect this condition and report it back to you in a more intelligent manner. Notice that Hugs does catch overflows to its own evaluation stack, and reports this back to you. But, there are cases (like the one below) where the C stack grows out of bounds faster than the evaluation stack. --sigbjorn ----- Original Message ----- From: "Bernhard Reus" <bernhard@cogs.susx.ac.uk> To: <hugs-bugs@haskell.org> Sent: Wednesday, January 16, 2002 09:18 Subject: undefined functions
The following behaviour of infinite recursion seems exaggerated:
script test.hs contains only
undef :: Int->Int undef x = undef x + 1
:l test :t undef undef:: Int->Int undef 1 Segmentation fault
Shouldn't this rather run into an infinite loop or a memory overflow. But segmentation fault?
Best, Bernhard
_______________________________________________ Hugs-Bugs mailing list Hugs-Bugs@haskell.org http://www.haskell.org/mailman/listinfo/hugs-bugs
participants (2)
-
Bernhard Reus -
Sigbjorn Finne