www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16333] New: show stack overflow as error message instead of

https://issues.dlang.org/show_bug.cgi?id=16333

          Issue ID: 16333
           Summary: show stack overflow as error message instead of
                    segfaulting
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

Is there any way that we can show the user that a stack overflow has happened?
Just a SEGFAULT is quite difficult to debug.
Consider this simple program:

```
void endless()
{
    endless();
}

void main()
{
    endless();
}
```

All it will print is:

segmentation fault (core dumped)  ./main

while it is quite easy to see what's going wrong here, in a more complex
application it isn't. At least it took me a couple of hours to realize that my
program doesn't do semi-random segfaults (given special input data), but
deterministic stack overflows.

Even C++ throws a StackOverflow Error.

--
Jul 28 2016