# Seg fault using optparse

**URL:** <https://rubytalk.org/t/seg-fault-using-optparse/12527>\
**Category:** ruby-talk\
**Created:** [12 July 2004 16:04 UTC](https://rubytalk.org/t/seg-fault-using-optparse/12527 "2004-07-12T16:04:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_McGovern2](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@Robert\_McGovern2](https://rubytalk.org/u/Robert_McGovern2)\
**Post date:** [12 July 2004 16:04 UTC](https://rubytalk.org/t/seg-fault-using-optparse/12527/1 "2004-07-12T16:04:17Z")

</div>

> > Robert McGovern wrote in [ruby-talk:106071]:  
> > Initial backtrace yields nothing useful:
> 
> You'll need also -g3 -ggdb options.

Hmm that didn't help, I assume that I am doing something wrong.

If CFLAGS=-g3 -ggdb are used, then the problem does not occur (with 0 to 25 arguments)

Which CFLAGS=-g3 -O2 -ggdb

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

Program exited normally.  
(gdb) run opttest.rb 1 2 3 4 5  
Starting program: /usr/local/bin/ruby.exe opttest.rb 1 2 3 4 5

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

Rob
