From nobody@FreeBSD.org  Sat Jul  2 16:25:36 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 424FA16A41C
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  2 Jul 2005 16:25:36 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3007943D1D
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  2 Jul 2005 16:25:36 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j62GPZnZ023041
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 2 Jul 2005 16:25:35 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j62GPZRw023040;
	Sat, 2 Jul 2005 16:25:35 GMT
	(envelope-from nobody)
Message-Id: <200507021625.j62GPZRw023040@www.freebsd.org>
Date: Sat, 2 Jul 2005 16:25:35 GMT
From: Kyryll A Mirnenko <mirya@matrix.ua>
To: freebsd-gnats-submit@FreeBSD.org
Subject: lang/ruby18: -fomit-frame-pointer causes segfault
X-Send-Pr-Version: www-2.3

>Number:         82894
>Category:       misc
>Synopsis:       lang/ruby18: -fomit-frame-pointer causes segfault
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 02 16:30:15 GMT 2005
>Closed-Date:    Sat Jul 02 18:16:24 GMT 2005
>Last-Modified:  Sat Jul  2 18:20:20 GMT 2005
>Originator:     Kyryll A Mirnenko
>Release:        5.4p3
>Organization:
>Environment:
FreeBSD localhost 5.4-RELEASE-p3 FreeBSD 5.4-RELEASE-p3 #42: Thu Jun 30 23:16:44 EEST 2005     root@localhost:/usr/src/sys/i386/compile/MY  i386
>Description:
      When building lang/ruby18 with -fomit-frame-pointer in CFLAGS building aborts due to ruby segfault:

..
cc -shared -Wl,-soname,libruby18.so.18  array.o  bignum.o  class.o  compar.o  dir.o  dln.o  enum.o  error.o  eval.o  file.o  gc.o  hash.o  inits.o  io.o  marshal.o  math.o  numeric.o  object.o  pack.o  parse.o  process.o  prec.o  random.o  range.o  re.o  regex.o  ruby.o  signal.o  sprintf.o  st.o  string.o  struct.o  time.o  util.o  variable.o  version.o   dmyext.o -lcrypt -lm -pthread  -o libruby18.so.18
./lib/mkmf.rb:314: [BUG] Segmentation fault
ruby 1.8.2 (2004-12-25) [i386-freebsd5]

Abort trap (core dumped)
*** Error code 134
1 error
*** Error code 2

Removing the cc option resolves the problem. Tested for
CFLAGS=-O3 -pipe -march=pentium2 (ok)
CFLAGS=-O3 -pipe -march=pentium2 -fomit-frame-pointer (fails)
>How-To-Repeat:
      try building lang/ruby18 with -fomit-frame-pointer in CFLAGS
>Fix:
      Suggest checking CFALGS in Makefile & warn if buggy cc flag is found
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: kris 
State-Changed-When: Sat Jul 2 18:15:45 GMT 2005 
State-Changed-Why:  
Nonstandard CFLAGS are documented to potentially cause problems, so 
this is firmly a case of "don't do that then". 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82894 

From: Kris Kennaway <kris@obsecurity.org>
To: Kyryll A Mirnenko <mirya@matrix.ua>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: misc/82894: lang/ruby18: -fomit-frame-pointer causes segfault
Date: Sat, 2 Jul 2005 14:15:24 -0400

 On Sat, Jul 02, 2005 at 04:25:35PM +0000, Kyryll A Mirnenko wrote:
 > 
 > >Number:         82894
 > >Category:       misc
 > >Synopsis:       lang/ruby18: -fomit-frame-pointer causes segfault
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Sat Jul 02 16:30:15 GMT 2005
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Kyryll A Mirnenko
 > >Release:        5.4p3
 > >Organization:
 > >Environment:
 > FreeBSD localhost 5.4-RELEASE-p3 FreeBSD 5.4-RELEASE-p3 #42: Thu Jun 30 23:16:44 EEST 2005     root@localhost:/usr/src/sys/i386/compile/MY  i386
 > >Description:
 >       When building lang/ruby18 with -fomit-frame-pointer in CFLAGS building aborts due to ruby segfault:
 > 
 > ..
 > cc -shared -Wl,-soname,libruby18.so.18  array.o  bignum.o  class.o  compar.o  dir.o  dln.o  enum.o  error.o  eval.o  file.o  gc.o  hash.o  inits.o  io.o  marshal.o  math.o  numeric.o  object.o  pack.o  parse.o  process.o  prec.o  random.o  range.o  re.o  regex.o  ruby.o  signal.o  sprintf.o  st.o  string.o  struct.o  time.o  util.o  variable.o  version.o   dmyext.o -lcrypt -lm -pthread  -o libruby18.so.18
 > ./lib/mkmf.rb:314: [BUG] Segmentation fault
 > ruby 1.8.2 (2004-12-25) [i386-freebsd5]
 > 
 > Abort trap (core dumped)
 > *** Error code 134
 > 1 error
 > *** Error code 2
 > 
 > Removing the cc option resolves the problem. Tested for
 > CFLAGS=-O3 -pipe -march=pentium2 (ok)
 > CFLAGS=-O3 -pipe -march=pentium2 -fomit-frame-pointer (fails)
 > >How-To-Repeat:
 >       try building lang/ruby18 with -fomit-frame-pointer in CFLAGS
 > >Fix:
 >       Suggest checking CFALGS in Makefile & warn if buggy cc flag is found
 
 There's already a warning in make.conf and the manpage, so this is not
 necessary.  We assume that people who choose to use nonstandard CFLAGS
 know what they're doing.
 
 Kris
>Unformatted:
