Subject: The _weirdest_ segfault...
To: None <>
From: Andreas Falck <>
List: port-alpha
Date: 05/17/2000 21:39:27

I've been using NetBSD 1.4.1 on a 21164 for some while now. It's a pc164
oem motherboard, nothing special about that. However, yesterday I ran into
a weird thing that I cannot explain. I've had taken a course in unix
system programming at my university, where the task was to develop a shell
on FreeBSD (x86). When it was done I decided to port i to the alpha, and
with a very few changes to the source code I made it compile without
warnings (-Wall -Wpointer-arith -Wcast-align).
Though, when trying to run it it failed very soon:

(gdb) run
Starting program: /usr/home/andreas/src/amish/netbsd/amish 
amish>pushd /usr

Program received signal SIGSEGV, Segmentation fault.
0x160541330 in malloc ()
(gdb) backtrace
#0  0x160541330 in malloc ()
#1  0x1200062b0 in nexttoken () at tokenizer.c:126
#2  0x120005888 in cmdparse (cmd=0x12010d060) at parser.c:278

**** Segfault in malloc!?! ****

Anyone knows or have an idea how it is possible? I could guess it might
have something to do with wrong alignment, but shouldn't the kernel fix 
such things? (my sysctl settings are such, according to the faq).

It's not that I need the shell running on my alpha (there are better
shells :) but it would be interesting to know why it segfaults. The only
libraries included is readline and ncurses.