seg fault using optparse

R

Robert McGovern

Was running the optparse test program with 4 arguments (opttest.rb) under cygwin when it seg faulted. I have included the output of two different cygwin boxes (one at home, one work), both versions of Ruby are HEAD though a couple of days apart. Tried to get a strack trace, but when I recompiled ruby without the CFLAG O2, the problem disappeared.

robertm@PC126 ~/rubysource/sample/optparse
$ ruby opttest.rb 1 2 3
#<Object:0x10109480 @exec=true>
ARGV = 1 2 3

robertm@PC126 ~/rubysource/sample/optparse
$ ruby opttest.rb 1 2 3 4
/usr/local/lib/ruby/1.9/optparse.rb:1382: [BUG] Segmentation fault
ruby 1.9.0 (2004-07-06) [i386-cygwin]

Aborted (core dumped)

robertm@PC126 ~/rubysource/sample/optparse
$ ruby opttest.rb 1 2 3 4 5
#<Object:0x10109480 @exec=true>
ARGV = 1 2 3 4 5

On a different Cygwin box it fails with 5 arguments but is fine with 4 and 6

robertm@al ~/ruby/sample/optparse
$ ruby opttest.rb 1 2 3
#<Object:0x10109480 @exec=true>
ARGV = 1 2 3

robertm@al ~/ruby/sample/optparse
$ ruby opttest.rb 1 2 3 4
#<Object:0x10109480 @exec=true>
ARGV = 1 2 3 4

robertm@al ~/ruby/sample/optparse
$ ruby opttest.rb 1 2 3 4 5
/usr/local/lib/ruby/1.9/optparse.rb:1382: [BUG] Segmentation fault
ruby 1.9.0 (2004-07-10) [i386-cygwin]

Aborted (core dumped)

robertm@al ~/ruby/sample/optparse
$ ruby opttest.rb 1 2 3 4 5 6
#<Object:0x10109480 @exec=true>
ARGV = 1 2 3 4 5 6

Initial backtrace yields nothing useful:

$ gdb ruby
GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run opttest.rb 1 2 3 4
Starting program: /usr/local/bin/ruby.exe opttest.rb 1 2 3 4

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? () from
(gdb) bt
#0 0x00000000 in ?? () from

Recompiled ruby without the O2 optimization and tried again

(gdb) run opttest.rb 1 2 3 4
Starting program: /usr/local/bin/ruby.exe opttest.rb 1 2 3 4
#<Object:0x1011b9d8 @exec=true>
ARGV = 1 2 3 4

Program exited normally.

Anyone else verify?

Thanks

Rob
 
N

nobu.nokada

Hi,

At Mon, 12 Jul 2004 21:27:17 +0900,
Robert McGovern wrote in [ruby-talk:106071]:
Initial backtrace yields nothing useful:

You'll need also -g3 -ggdb options.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top