[MacRuby-devel] [MacRuby] #615: macruby segfaults when generating large random numbers
MacRuby
ruby-noreply at macosforge.org
Tue Feb 16 19:03:42 PST 2010
#615: macruby segfaults when generating large random numbers
-------------------------------+--------------------------------------------
Reporter: ahobson@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: major | Milestone:
Component: MacRuby | Keywords: rand bignum
-------------------------------+--------------------------------------------
Comment(by ahobson@…):
I just noticed that assigning to a variable seems to affect the behavior
if I generate a smaller number.
{{{
# notice no crash!
% macruby -e 'x=rand(2**1024)'
# but this does crash
% macruby -e 'x=rand(2**1024);puts x'
unknown: [BUG] Segmentation fault
MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]
zsh: abort macruby -e 'x=rand(2**1024);puts x'
# maybe we just got lucky before?
% macruby -e 'x=rand(2**1024)'
% macruby -e 'x=rand(2**1024)'
% macruby -e 'x=rand(2**1024)'
# doesn't seem like it. But generating a larger random number always
seems to crash
% macruby -e 'x=rand(2**2048)'
unknown: [BUG] Segmentation fault
MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]
zsh: abort macruby -e 'x=rand(2**2048)'
% macruby -e 'x=rand(2**2048)'
unknown: [BUG] Segmentation fault
MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]
zsh: abort macruby -e 'x=rand(2**2048)'
# hmm, where does the problem seem to occur between 1024 and 2048?
# 2**1472 seems to be reliably ok
% macruby -e 'x=rand(2**1472)'
% macruby -e 'x=rand(2**1472)'
% macruby -e 'x=rand(2**1472)'
# but 2**1473 seems to reliably crash
% macruby -e 'x=rand(2**1473)'
unknown: [BUG] Segmentation fault
MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]
zsh: abort macruby -e 'x=rand(2**1473)'
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/615#comment:3>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list