[comp.bugs.2bsd] Problem with multiplication of

cr@dukempd.UUCP (Cyrus Rahman) (11/28/86)

	We have recently brought up 2.9bsd on our 11/70, and although
it has a number of bugs it is a generally good system.  It would be
nice if symbolic links really worked, and the quota feature fails in
a spectacular way.  But there is only one bug I am aware of now that
I need to fix quickly:

Subject: The libc/crt routines for hardware mult./divide don't work properly.

Index:	/usr/src/lib/c/crt 2.9bsd

Description:

	The routines run with the appropriate interrupt bits of the
	fpu disabled, so when overflow occurs during long multiplication the
	result is 0 instead of the truncated product.

Repeat-By:

	Run something that uses rand().  This program demonstrates the
	problem as well:

		#include <stdio.h>
		main() {
		long x;

		for (x = 2; x != 0; x *= 2 + 1)
			printf("x is %ld\n");
		}

	The program will terminate if linked with libc.a, but will behave
	properly if linked with libnonfpc.a.

Fix:
	The problem is not difficult to solve, but fixing it properly
	will require understanding how the fpu is managed by the
	kernel and what state C expects to find it in.

	If someone has already done this I would be grateful for
	their advice.
-- 
	Cyrus Rahman				1-919-684-8226
	Duke University Dept. of Physics	cr@dukempd.uucp
	Durham, N.C.      27706			mcnc!duke!dukempd!cr

root@uokmet.UUCP (12/01/86)

>	We have recently brought up 2.9bsd on our 11/70, and although
>it has a number of bugs it is a generally good system.  It would be
>nice if symbolic links really worked, and the quota feature fails in
>a spectacular way.  But there is only one bug I am aware of now that
>I need to fix quickly:

It is easy to fix the symbolic link bug.  The problem is that the
symbolic link routine names are surrounded by "#ifdef UCB_NET" in
"struct sysent syslocal[]" of sys/sysent.c.  Remove the "ifdef"
and "endif".  This will solve the problem.

Also, be sure to recompile all the programs that use the
symlink() call.  

	Kevin W. Thomas
	Univ. of Oklahoma
	School of Meteorology
	Norman, Oklahoma

UUCP:	ihnp4!occrsh!uokmet!kwthomas	ihnp4!okstate!uokmax!uokmet!kwthomas