Bug #8687
closedmathn and round causes an segmentationfault
Description
require "mathn"; (5/2).round(2)
-- Control frame information -----------------------------------------------
c:0019 p:---- s:0076 e:000075 CFUNC :round
c:0018 p:0013 s:0072 e:000071 EVAL (irb):4 [FINISH]
c:0017 p:---- s:0070 e:000069 CFUNC :eval
c:0016 p:0024 s:0063 e:000062 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/workspace.rb:86
c:0015 p:0025 s:0056 e:000054 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/context.rb:380
c:0014 p:0022 s:0050 e:000049 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:492
c:0013 p:0040 s:0042 e:000041 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:624
c:0012 p:0009 s:0037 e:000036 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:489
c:0011 p:0118 s:0033 e:000032 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:247 [FINISH]
c:0010 p:---- s:0030 e:000029 CFUNC :loop
c:0009 p:0007 s:0027 e:000026 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:233 [FINISH]
c:0008 p:---- s:0025 e:000024 CFUNC :catch
c:0007 p:0015 s:0021 e:000020 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:232
c:0006 p:0030 s:0018 E:0009a8 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:488
c:0005 p:0008 s:0015 e:000014 BLOCK /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:397 [FINISH]
c:0004 p:---- s:0013 e:000012 CFUNC :catch
c:0003 p:0143 s:0009 E:001178 METHOD /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:396
c:0002 p:0112 s:0004 E:000ca8 EVAL /Users/hanmac/.rvm/rubies/ruby-head/bin/irb:15 [FINISH]
c:0001 p:0000 s:0002 E:0011e8 TOP [FINISH]
/Users/hanmac/.rvm/rubies/ruby-head/bin/irb:15:in <main>' /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:396:in
start'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:396:in catch' /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:397:in
block in start'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:488:in eval_input' /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:232:in
each_top_level_statement'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:232:in catch' /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:233:in
block in each_top_level_statement'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:233:in loop' /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb:247:in
block (2 levels) in each_top_level_statement'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:489:in block in eval_input' /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:624:in
signal_status'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb:492:in block (2 levels) in eval_input' /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/context.rb:380:in
evaluate'
/Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/workspace.rb:86:in evaluate' /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/workspace.rb:86:in
eval'
(irb):4:in irb_binding' (irb):4:in
round'
-- C level backtrace information -------------------------------------------
0 libruby.2.1.0.dylib 0x000000010cada749 rb_vm_bugreport + 137
1 libruby.2.1.0.dylib 0x000000010c99ee2b report_bug + 283
2 libruby.2.1.0.dylib 0x000000010c99ed04 rb_bug + 180
3 libruby.2.1.0.dylib 0x000000010ca5f190 sigsegv + 144
4 libsystem_c.dylib 0x00007fff9081194a _sigtramp + 26
5 libruby.2.1.0.dylib 0x000000010ca2e1ea nurat_round + 10
6 ??? 0x0000000000000000 0x0 + 0
-- Other runtime information -----------------------------------------------
-
Loaded script: irb
-
Loaded features:
0 enumerator.so
1 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x86_64-darwin12.4.0/enc/encdb.bundle
2 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x86_64-darwin12.4.0/enc/trans/transdb.bundle
3 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x86_64-darwin12.4.0/rbconfig.rb
4 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/compatibility.rb
5 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/defaults.rb
6 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/deprecate.rb
7 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/errors.rb
8 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/version.rb
9 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/requirement.rb
10 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/platform.rb
11 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb
12 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/exceptions.rb
13 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb
14 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/thread.rb
15 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/monitor.rb
16 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb
17 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems.rb
18 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/e2mmap.rb
19 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/init.rb
20 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/workspace.rb
21 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/inspector.rb
22 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/context.rb
23 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/extend-command.rb
24 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/output-method.rb
25 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/notifier.rb
26 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/slex.rb
27 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-token.rb
28 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/ruby-lex.rb
29 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/src_encoding.rb
30 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/magic-file.rb
31 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x86_64-darwin12.4.0/readline.bundle
32 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/input-method.rb
33 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/locale.rb
34 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb.rb
35 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/path_support.rb
36 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb
37 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/irb/completion.rb
38 /Users/hanmac/.rvm/scripts/irbrc.rb
39 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/cmath.rb
40 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/matrix.rb
41 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/singleton.rb
42 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/forwardable.rb
43 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/prime.rb
44 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x86_64-darwin12.4.0/mathn/rational.bundle
45 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/x86_64-darwin12.4.0/mathn/complex.bundle
46 /Users/hanmac/.rvm/rubies/ruby-head/lib/ruby/2.1.0/mathn.rb
Updated by nobu (Nobuyoshi Nakada) over 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r42178.
Hans, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
rational.c: ensure to be Rational
- rational.c (f_round_common): Rational is expected to be returned by
Rational#*, but mathn.rb breaks that assumption. [ruby-core:56177]
[Bug #8687]
Updated by nobu (Nobuyoshi Nakada) over 11 years ago
- Description updated (diff)
- Priority changed from 6 to Normal
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) over 11 years ago
- Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED to 1.9.3: REQUIRED, 2.0.0: DONE
Backported to ruby_2_0_0 at r42217.
Updated by usa (Usaku NAKAMURA) over 11 years ago
- Backport changed from 1.9.3: REQUIRED, 2.0.0: DONE to 1.9.3: DONE, 2.0.0: DONE
Backported to ruby_1_9_3 at r42326.