Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site redwood.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!hao!hplabs!hpda!fortune!foros1!redwood!rpw3
From: rpw3@redwood.UUCP (Rob Warnock)
Newsgroups: net.unix-wizards
Subject: Re: Words wanted on 68000 invalid operand challenge
Message-ID: <59@redwood.UUCP>
Date: Thu, 11-Oct-84 19:59:09 EDT
Article-I.D.: redwood.59
Posted: Thu Oct 11 19:59:09 1984
Date-Received: Sat, 13-Oct-84 04:55:13 EDT
References: <328@ncoast.UUCP> <192@sol1.UUCP> <4019@elsie.UUCP> <181@rlgvax.UUCP>
Organization: Rob Warnock, Redwood City, CA
Lines: 32

Fortune Systems' C compiler is also MIT-derived (circa 1981), but apparently
has been fixed some time in the past, as your example compiled just fine
(edited for brevity and annotated):

	$ cat bugchar.c
	struct line {	char len; char flags; char l[MAXLLEN];};
	_fixlines() {	register struct line *	lp;
			register char *		p;
			lp->len = p + 1 - lp->l;	}

	$ cc -O -S bugchar.c	# Fortune Systems C compiler Release 1.7

	$ cat bugchar.s			# Notes:
	_fixlines:
		jsr	_csav
		link	%a6,#-.F1	| .F1 is count of regs used (in bytes)
		moveml	#.S1,%sp@	| .S1 is mask of regs used
		lea	%a4@(1),%a0	| "p + 1" (note optimization)
		lea	%a5@(2),%a1	| "lp->l"
		subl	%a1,%a0		| " - "
		movw	%a0,%d0		| <-- missing in compilers with bug?
		movb	%d0,%a5@	| "lp->len = ..." (looks o.k. to me)
		moveml	%a6@(-.F1),#.S1
		unlk	%a6
		rts

Rob Warnock

UUCP:	{ihnp4,ucbvax!amd}!fortune!redwood!rpw3
DDD:	(415)572-2607	(*new*)
Envoy:	rob.warnock/kingfisher
USPS:	510 Trinidad Ln, Foster City, CA  94404	(*new*)