How to avoid Segmentation Fault 11 on infinite recursion?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to avoid Segmentation Fault 11 on infinite recursion?

Nathan Ridge via cfe-dev
Hi.

I am writing a simple interpreter using C++ and I need to throw exception on infinite recursion.
Currently the program falls with Segmentation fault 11.
Is there a method to avoid it?

Thank you,
Andrey Sharoyko.
----
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to avoid Segmentation Fault 11 on infinite recursion?

Nathan Ridge via cfe-dev
You just have to hardcode in limits (avoid recursion as much as reasonable, reduce stack frame sizes, etc - but ultimately you'll want counters in to bail out at very deep recursions, like Clang has).

On Wed, Jun 26, 2019 at 11:57 AM Andrey Sharoyko via cfe-dev <[hidden email]> wrote:
Hi.

I am writing a simple interpreter using C++ and I need to throw exception on infinite recursion.
Currently the program falls with Segmentation fault 11.
Is there a method to avoid it?

Thank you,
Andrey Sharoyko.
----
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev