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.