[MacRuby-devel] Segmentation fault for classes with multiple modules chained with super

Alexey Borzenkov snaury at gmail.com
Mon Aug 31 14:04:04 PDT 2009


On Tue, Sep 1, 2009 at 1:01 AM, Alexey Borzenkov<snaury at gmail.com> wrote:
> The following program causes segmentation fault for me with the latest
> macruby trunk:
>
> class A
>  def somemethod
>    puts "A::somemethod"
>  end
> end
>
> module B
>  def somemethod
>    super
>    puts "B::somemethod"
>  end
> end
>
> module C
>  def somemethod
>    super
>    puts "C::somemethod"
>  end
> end
>
> class D < A
>  include B
>  include C
>  def somemethod
>    super
>    puts "D::somemethod"
>  end
> end
>
> obj = D.new
> obj.somemethod
>
> Thanks to http://weblog.rubyonrails.org/2009/8/31/three-reasons-love-responder
> I just found that modules can be chained via super like that, so I
> immediately went to check it out, and in MRI 1.8 it works fine. I
> wanted to see it in 1.9, so I checked with macruby and it caused
> segmentation fault. I recompiled latest macruby trunk and it's still
> happening. As stated in the README.rdoc I'm using llvm trunk at
> revision 72741. Is it llvm or macruby bug? Oddly, under gdb it just
> freezes, can't even see any stack trace. :-/

Correction: if I printed before calling super I'd see that it causes
infinite recursion. Seems like it shouldn't be doing that...


More information about the MacRuby-devel mailing list