Words wanted on 68000 invalid operand challenge

Rob Warnock rpw3 at redwood.UUCP
Fri Oct 12 09:59:09 AEST 1984


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*)



More information about the Comp.unix.wizards mailing list