Forum: Ruby Ruby 1.9.0 crash on Kubuntu Hardy Heron

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bug F. (Guest)
on 2008-12-17 19:12
Hi,

Ruby 1.9.0 crashes on the following code:
======================
class Foo
  def Foo.get
    return true if defined? @@x && @@x <= 0
  end
end
Foo.get
======================

This is the version:
clay:~/tests/ruby/bugs$ ruby1.9 -v
ruby 1.9.0 (2007-12-25 revision 14709) [i486-linux]

This is the stack trace:
clay:~/tests/ruby/bugs$ ruby1.9 crash.rb
crash.rb:7: [BUG] Stack consistency error (sp: 10, bp: 9)
ruby 1.9.0 (2007-12-25 revision 14709) [i486-linux]

-- control frame ----------
c:0004 p:0025 s:0010 b:0009 l:000008 d:000008 METHOD crash.rb:7
c:0003 p:0020 s:0006 b:0006 l:000005 d:000005 TOP    crash.rb:10
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP    <dummy toplevel>:17
---------------------------
DBG> : "crash.rb:10:in `<main>'"
-- backtrace of native function call (Use addr2line) --
0xb7f4560c
0xb7e6d3a6
0xb7e6d402
0xb7f3ed80
0xb7f42d09
0xb7f43382
0xb7e7361b
0xb7e736e3
0x8048752
0xb7c81450
0x8048681
-------------------------------------------------------
Aborted
Brian C. (Guest)
on 2008-12-17 19:16
Bug F. wrote:
> Hi,
>
> Ruby 1.9.0 crashes on the following code:
> ======================
> class Foo
>   def Foo.get
>     return true if defined? @@x && @@x <= 0
>   end
> end
> Foo.get
> ======================
>
> This is the version:
> clay:~/tests/ruby/bugs$ ruby1.9 -v
> ruby 1.9.0 (2007-12-25 revision 14709) [i486-linux]

Your program works fine for me on 1.9.1-preview2, under Ubuntu Hardy.

$ ruby19 crash.rb
$ ruby19 -v
ruby 1.9.1 (2008-12-01 revision 20438) [i686-linux]
$

So maybe you just need to upgrade.
This topic is locked and can not be replied to.