[clean-list] My very first program crashes!

John van Groningen johnvg@cs.kun.nl
Tue, 29 May 2001 17:44:09 +0200


Maarten de Mol wrote:
>...
>The problem is that currently the Clean runtime system is NOT able to detect
>stack overflow at all. Clean will not even issue a 'Stack Fault' but simply
>crash.
>This is the major flaw IMO.

This is not the case for the implementation of Clean for the Macintosh. If
the 'Check Stacks' option is enabled the code generator of Clean will
generate extra code to detect a stack overflow. If such an overflow is
detected, 'Stack overflow' is printed.

This feature is currenlty not available on Windows, but has already been
implemented and will be available when a new version of Clean is released
for Windows.

>> The first two lines here are probably not especially helpful.
>> But the last line may help a lot, particularly for newcomers.
>
>It helps in finding out *what* went wrong, but not in *where* it went wrong.
>...

With Clean for the Macintosh you also find out *where* it wrong in most cases
by enabling the 'Check Stacks' overflow option described above, and also
enabling 'Stack trace only' (only with Clean IDE 2.0) or time profiling
(both IDE's). If a stack overflow is detected, the runtime system will then
also show a stack trace of the top of the stack (the last functions called).

Generating stack traces is already possible with Clean 1.3.3 on Windows, but
not when a stack overflow occurs because the 'Check Stack' option is missing.
This will be possible when a new version is released.

Regards,
John van Groningen