# Segmentation fault in recursive function

**URL:** <https://rubytalk.org/t/segmentation-fault-in-recursive-function/26621>\
**Category:** ruby-talk\
**Created:** [13 April 2006 06:24 UTC](https://rubytalk.org/t/segmentation-fault-in-recursive-function/26621 "2006-04-13T06:24:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Sheppard](https://avatars.discourse-cdn.com/v4/letter/d/db5fbb/32.png) [@Daniel\_Sheppard](https://rubytalk.org/u/Daniel_Sheppard)\
**Post date:** [13 April 2006 06:24 UTC](https://rubytalk.org/t/segmentation-fault-in-recursive-function/26621/1 "2006-04-13T06:24:38Z")

</div>

It's most likely because something isn't compiled right. It's just as  
likely gentoo's fault as it is ruby's. Upgraded your gcc lately? Updated  
any of a thousand other dependent libraries lately?

Give revdep-rebuild a go.

If not, give emerge -e ruby a go

Or if you'd actually like to diagnose the problem, try running gdb and  
get a bit more info about your segfault.

run:

ulimit -c unlimited  
ruby segfault.rb

that should produce a core file

gdb ruby core

(gdb) bt

Or something like that.

> **···**
>
> > -----Original Message-----  
> > From: Sven Klemm [mailto:sven@c3d2.de]  
> > Sent: Thursday, 13 April 2006 5:47 AM  
> > To: ruby-talk ML  
> > Subject: Segmentation fault in recursive function
> > 
> > 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
