[comp.lang.c] Problems with hoc in Kernighan&Pike

wood@maccs.dcss.mcmaster.ca (T_Rex) (09/25/90)

Hello,
	I'm attempting to get the hoc ( high order calculator ) example in
Kernighan and Pike's The_Unix_Programming_Environment up and running. I've
run into a problem in stage six. When I attempt to run the fib example ( every-
thing compiles and links fine ) I get a bus error and core dump. Under dbx, I
find the following problem:

hoc>dbx hoc6
Reading symbolic information...
Read 1358 symbols
(dbx) run fib -
Running: hoc6 fib - 
fib(10)
signal BUS (alignment error) in execute at line 417 in file "code.c"
  417                   (*(*pc++))();
(dbx) quit

lint tells me that there is possibly an error in pointer alignment in the
line
	yyval.sym = (Symbol *)emalloc(strlen(sbuf)+1)
in hoc.y

	We've compiled and tried to run this code on a Sun4, Sun3, and a
microVax, on the chance that this is a portability problem. No such luck;
we get the exact same problem in all three cases. All the other examples
in the text run ok.

	Has anyone dealt with this problem before, or have any suggestions?
Please reply by e-mail; I'll forward the contents of responses to anyone who
is interested, or summarize on the net if there is enough interest.

Thanks in advance,

Pete Wood 		e-mail wood@maccs.dcss.mcmaster.ca