Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site axiom.UUCP
Path: utzoo!linus!axiom!smk
From: smk@axiom.UUCP (Steven M. Kramer)
Newsgroups: net.wanted,net.micro.68k
Subject: Re: MIT 68000 C cross compiler bugs
Message-ID: <492@axiom.UUCP>
Date: Sun, 19-Feb-84 23:09:57 EST
Article-I.D.: axiom.492
Posted: Sun Feb 19 23:09:57 1984
Date-Received: Mon, 20-Feb-84 02:21:50 EST
References: <194@dutesta.UUCP>
Organization: Axiom Technology, Newton MA
Lines: 40

Well, you asked for more bugs.  Here's one I found today:

	The 68000 allows all kinds of effective addresses in moves with
one exception -- you cannot have a byte move with the source address
being the address direct register mode.  Well, try this out on the MIT
compiler:
-------------------------
struct line {
	char    len;
	char    l[80];
};

fixlines() {
	register struct line   *lp;
	register char  *p;

asm("before_bug:");
	lp->len = p +1 - lp->l;
asm("after_bug:");
}
--------------------------
The results getting computed, p+1 and lp->l, are both put into address
register because they point to addresses.  However, their result is
moved into lp->len, a byte move because len is a character.  The
offending instruction looks like:
movb	.a0,.a5@
where .a0 has the result and .a5 is lp, so .a5@ points to the first
element in the structure, or lp->len.

I think the trick is to assume (??) that all byte moves deal with
data since I can't think of a case where the compiler would produce
something different, and change the above assembler output to:
movl	.a0,.d0
movb	.d0,.a5@
I know it's a waste, but, hey, it's quick and dirty!  Now to find out
where this kludge goes...
-- 
	--steve kramer
	{allegra,genrad,ihnp4,utzoo,philabs,uw-beaver}!linus!axiom!smk	(UUCP)
	linus!axiom!smk@mitre-bedford					(MIL)