Subject: Re: newfs segfaults
To: Christopher SEKIYA <wileyc@rezrov.net>
From: Luke Mewburn <lukem@wasabisystems.com>
List: port-alpha
Date: 01/06/2002 20:34:33
On Sat, Jan 05, 2002 at 08:05:34PM +0900, Christopher SEKIYA wrote:
  | Interesting failure with newfs compiled from last night's -current:
  | 
  | inasa# gdb ./newfs
  | GNU gdb 5.0-nb1
  | (gdb) set args /dev/rwd0g
  | (gdb) run
  | Starting program: /usr/local/local_source/builder/sbin/newfs/obj/./newfs /dev/rwd0g
  | /dev/rwd0g:     4194288 sectors in 4161 cylinders of 16 tracks, 63 sectors
  |         2048.0MB in 49 cyl groups (86 c/g, 42.33MB/g, 10432 i/g)
  | super-block backups (for fsck -b #) at:
  |       32,   86784,
  | Program received signal SIGSEGV, Segmentation fault.
  | initcg (cylno=2, utime=597)
  |     at /usr/local/local_source/builder/sbin/newfs/mkfs.c:780

I've managed to reproduce this on my alpha as well, including using
newfs sources from a couple of months ago (although my sys/ufs/ffs
sources are more recent in the test case).  I believe it's caused by
using gcc -O2 (or higher) with the new toolchain.

What version of gcc are you running?
Are you compiling with gcc -O2 (or higher)?

What happens if you add the following to the end of newfs/Makefile
(after .include <bsd.prog.mk>)
	CFLAGS+=-O1
recompile, and try the resultant binary?

Luke.

--
Luke Mewburn  <lukem@wasabisystems.com>  http://www.wasabisystems.com
Luke Mewburn     <lukem@netbsd.org>      http://www.netbsd.org
Wasabi Systems - NetBSD hackers for hire
NetBSD - the world's most portable UNIX-like operating system