# Segmentation fault in recursive function

**URL:** <https://www.ruby-forum.com/t/segmentation-fault-in-recursive-function/57665>\
**Category:** Ruby\
**Created:** [April 12, 2006, 9:49pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-recursive-function/57665 "2006-04-12T21:49:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fink](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/85f322/32.png) [@fink](https://www.ruby-forum.com/u/fink)\
**Post date:** [April 12, 2006, 9:49pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-recursive-function/57665/1 "2006-04-12T21:49:08Z")

</div>

Hi,

when executing the attached code I get a segmentation fault.

I know the code does not make that much sense but nervertheless should  
ruby never segfault but throw a SystemStackError or something similar.

I am using ruby 1.8.4 under Gentoo (powerpc). On a x86 computer the code  
correctly throws a SystemStackError.

Greetings,  
Sven

---

<div class="post-metadata">

**Author:** ![fink](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/85f322/32.png) [@fink](https://www.ruby-forum.com/u/fink)\
**Post date:** [April 13, 2006, 10:35am UTC](https://www.ruby-forum.com/t/segmentation-fault-in-recursive-function/57665/2 "2006-04-13T10:35:11Z")

</div>

Hi,

2006/4/13, Sven K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I know the code does not make that much sense but nervertheless should  
> ruby never segfault but throw a SystemStackError or something similar.
> 
> I am using ruby 1.8.4 under Gentoo (powerpc). On a x86 computer the code  
> correctly throws a SystemStackError.

Stack overflow can’t be caught always. There’s no way (portable one,  
at least) to tell it from other segfaults.
