Why the 4.3BSD C compiler seem to botch this ?

Dan Ts'o dan at rna.UUCP
Mon Apr 18 10:33:03 AEST 1988


	The code below seems okay and does passed thru SUN's C compiler fine,
but the 4.3BSD C compiler misgenerates a label, causing an assembler error
messages and an unknown external (during loading). (Yes, I know that z is not
used. Its removal has no effect on the problem.)

/* Shellsort */
fsort(a, z, n)
register double *a;
register unsigned z, n;
{
	double w;
	register unsigned i, j, k;

	k = 1;
	n++;
	do {
		k = 3*k + 1;
	} while (k <= n);
	for (k /= 3; k > 0; k /= 3) {
		for (i = k; i < n; i++) {
			w = a[i];
			for (j = i - k; (j >= 0) && (a[j] > w); j -= k)
				a[j + k] = a[j];
			a[j] = w;
		}
	}
}

	Thanks.



More information about the Comp.unix.wizards mailing list