Hugs Bug !

Alastair Reid
22 Mar 2002 16:48:56 +0000

Ahn Ki-yung <> reports:

> {Apparently inessential details of program supressed]
> in unix/linux proper error msg comes out and back to interpreter.
> ERROR - Control stack overflow
> ===========
> but in windows 2000
> Then suddnly interpreter fails and
> the red (X) popup window pops up.
> hugs.exe - application programm error
>     unknown software exception (0xc000fd) ... blabla

This is a known problem in Hugs to do with overflows of the C stack.
The problem is:

- Hugs evaluation is done on the C stack and so some kinds of
  evaluation can cause stack overflows.
- OSs and C are pretty poor at detecting or avoiding stack overflows.

The reason you didn't see this in Unix is:

- Unix apparently assigns a different stack-size limit to Hugs.
  (I think you can tune stack size in Windows but forget how.)

- Hugs uses a 2nd stack 'the control stack' during evaluation.
  This is a normal C array which Hugs knows the size of so it can
  detect overflow in that stack.  

  Often, when you run out of C stack space, you were about to run out
  of control stack space anyway and when you run out of control stack
  space you were about to run out of C stack space.  (In other words,
  running out of either usually indicates a problem in your program
  which will not be solved by tweaking stack sizes.)
Hope this helps.

Alastair Reid