Project

General

Profile

Actions

Bug #10966

closed

Seg fault when param with default is followed by named param

Added by gregbeech (Greg Beech) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Target version:
-
[ruby-core:<unknown>]

Description

The last line of the following code sample causes a seg fault. This seems to be the case for any method where a hash is passed to a parameter with a default value, when the method also has a named parameter.

class Foo
  def self.seg_fault(a = {}, b: 0); end
end

Foo.seg_fault('x' => 'y')

The output of running this is below, and the crash report is attached.

bug.rb:5: [BUG] Segmentation fault at 0x00000000000010
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   for more details.

-- Control frame information -----------------------------------------------
c:0002 p:0027 s:0006 E:0009c0 EVAL   bug.rb:5 [FINISH]
c:0001 p:0000 s:0002 E:001390 TOP    [FINISH]

-- Ruby level backtrace information ----------------------------------------
bug.rb:5:in `<main>'

-- Machine register context ------------------------------------------------
 rax: 0x0000000000000000 rbx: 0x0000000101ac7028 rcx: 0x0000000000000000
 rdx: 0x0000000101ac7030 rdi: 0x0000000000000000 rsi: 0x0000000000000000
 rbp: 0x00007fff5e455620 rsp: 0x00007fff5e455560  r8: 0x0000000101ac7030
  r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
 r12: 0x00007f8622f4d9f0 r13: 0x00007f8622f4d920 r14: 0x00007f8622c08f80
 r15: 0x0000000000000000 rip: 0x0000000101945506 rfl: 0x0000000000010293

-- C level backtrace information -------------------------------------------
0   libruby.2.2.0.dylib                 0x000000010194cceb rb_vm_bugreport + 155
1   libruby.2.2.0.dylib                 0x00000001017f1100 rb_bug_context + 480
2   libruby.2.2.0.dylib                 0x00000001018c92c3 sigsegv + 83
3   libsystem_platform.dylib            0x00007fff8d956f1a _sigtramp + 26
4   libruby.2.2.0.dylib                 0x0000000101945506 setup_parameters_complex + 4758
5   ???                                 0x00007f862408af78 0x0 + 140214106894200

-- Other runtime information -----------------------------------------------

* Loaded script: bug.rb

* Loaded features:

    0 enumerator.so
    1 rational.so
    2 complex.so
    3 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/enc/encdb.bundle
    4 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/enc/trans/transdb.bundle
    5 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/unicode_normalize.rb
    6 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/rbconfig.rb
    7 thread.rb
    8 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/thread.bundle
    9 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/compatibility.rb
   10 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/defaults.rb
   11 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/deprecate.rb
   12 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/errors.rb
   13 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/version.rb
   14 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/requirement.rb
   15 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/platform.rb
   16 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/basic_specification.rb
   17 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/stub_specification.rb
   18 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/util/stringio.rb
   19 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb
   20 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/exceptions.rb
   21 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb
   22 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb
   23 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb
   24 /Users/greg/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
Don't forget to include the above Crash Report log file.
For details: http://www.ruby-lang.org/bugreport.html

Files

ruby_2015-03-11-125053_r1.crash (11.2 KB) ruby_2015-03-11-125053_r1.crash Crash report. gregbeech (Greg Beech), 03/11/2015 12:59 PM

Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #10734: Segfault when combining default arguments with keyword argumentsClosed01/12/2015Actions
Actions #1

Updated by usa (Usaku NAKAMURA) over 9 years ago

  • Status changed from Open to Closed

It's already fixed.
Check 2.2.1.

Actions #2

Updated by usa (Usaku NAKAMURA) over 9 years ago

  • Is duplicate of Bug #10734: Segfault when combining default arguments with keyword arguments added
Actions

Also available in: Atom PDF

Like0
Like0Like0