Project

General

Profile

Actions

Bug #10832

closed

while loop segmentation fault

Added by janfry (j j) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]
[ruby-core:68040]

Description

Hello everyone, this is my first bug report so please forgive me if I am doing something wrong:

The following small piece of code gives me a segmentation fault on he second iteration of the loop, as soon as I try inputting something for the second time (after first puts has executed):

while n = gets
  puts n
end

Full segfault output:

C:\Users\JFR\Documents\mydoc\math&code>ruby "small-loop.rb"
10
10
small-loop.rb:1: [BUG] Segmentation fault
ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0010 e:000009 CFUNC  :gets
c:0003 p:---- s:0008 e:000007 CFUNC  :gets
c:0002 p:0019 s:0005 E:001bd0 EVAL   small-loop.rb:1 [FINISH]
c:0001 p:0000 s:0002 E:002538 TOP    [FINISH]

-- Ruby level backtrace information ----------------------------------------
small-loop.rb:1:in `<main>'
small-loop.rb:1:in `gets'
small-loop.rb:1:in `gets'

-- C level backtrace information -------------------------------------------
C:\Windows\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0xa) [0x0000000076F512FA]
C:\Windows\system32\KERNELBASE.dll(WaitForSingleObjectEx+0x9c) [0x000007FEFD0910DC]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_vm_bugreport+0xa4) [0x000000006B417364]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_name_err_mesg_new+0x841) [0x000000006B2C9801]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_bug+0x45) [0x000000006B2CA545]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_check_safe_str+0x351) [0x000000006B398E11]
 [0x0000000000401A85]
C:\Windows\SYSTEM32\ntdll.dll(_C_specific_handler+0x9c) [0x0000000076F185C8]
C:\Windows\SYSTEM32\ntdll.dll(RtlDecodePointer+0xad) [0x0000000076F29D2D]
C:\Windows\SYSTEM32\ntdll.dll(RtlUnwindEx+0xbbf) [0x0000000076F191CF]
C:\Windows\SYSTEM32\ntdll.dll(KiUserExceptionDispatcher+0x2e) [0x0000000076F51248]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(st_lookup+0x11) [0x000000006B3A0C41]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_w32_read+0x382) [0x000000006B43C482]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_thread_io_blocking_region+0xd8) [0x000000006B422E38]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_call_inits+0x15e7) [0x000000006B2FA427]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_io_print+0x60a) [0x000000006B2FB9FA]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_io_check_char_readable+0x38e) [0x000000006B30197E]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_io_ascii8bit_binmode+0x13ed) [0x000000006B3074DD]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_io_ascii8bit_binmode+0x1433) [0x000000006B307523]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_vm_localjump_error+0x61db) [0x000000006B40B85B]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_vm_invoke_proc+0x960) [0x000000006B40D160]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_funcallv+0x29) [0x000000006B40D389]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_error_arity+0x1c6) [0x000000006B402206]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_vm_localjump_error+0x1618) [0x000000006B406C98]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_vm_localjump_error+0x5a8d) [0x000000006B40B10D]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_iseq_eval_main+0x1d0) [0x000000006B413E40]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(rb_check_copyable+0x304a) [0x000000006B2CF31A]
C:\Dev\Ruby21-x64\bin\x64-msvcrt-ruby210.dll(ruby_run_node+0x51) [0x000000006B2D2231]
 [0x0000000000402D14]
 [0x00000000004013D7]
 [0x00000000004014F8]
C:\Windows\system32\kernel32.dll(BaseThreadInitThunk+0xd) [0x0000000076DF59ED]

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

* Loaded script: small-loop.rb

* Loaded features:

    0 enumerator.so
    1 C:/Dev/Ruby21-x64/lib/ruby/2.1.0/x64-mingw32/enc/encdb.so
    2 C:/Dev/Ruby21-x64/lib/ruby/2.1.0/x64-mingw32/enc/iso_8859_1.so
    3 C:/Dev/Ruby21-x64/lib/ruby/2.1.0/x64-mingw32/enc/trans/transdb.so
    4 C:/Dev/Ruby21-x64/lib/ruby/2.1.0/x64-mingw32/rbconfig.rb
    5 thread.rb
    6 C:/Dev/Ruby21-x64/lib/ruby/2.1.0/x64-mingw32/thread.so
    7 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/compatibility.rb
    8 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/defaults.rb
    9 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/deprecate.rb
   10 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/errors.rb
   11 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/version.rb
   12 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/requirement.rb
   13 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/platform.rb
   14 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb
   15 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/stub_specification.rb
   16 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/util/stringio.rb
   17 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb
   18 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/exceptions.rb
   19 C:/Dev/Ruby21-x64/lib/ruby/2.1.0/rubygems/defaults/operating_system.rb
   20 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb
   21 C:/Dev/Ruby21-x64/lib/ruby/2.1.0/monitor.rb
   22 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb
   23 C:/Dev/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

C:\Users\JFR\Documents\mydoc\math&code>1

As you can see from my ruby -v I'm running on Windows 7 x64.
I hope this can help!

J@n


Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #10408: [BUG] Segmentation fault ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32] Closedcruby-windows10/21/2014Actions
Actions

Also available in: Atom PDF