[comp.sys.atari.st] Bug in MWC 3.0 -VPEEP

bammi@mandrill (Jwahar R. Bammi) (05/19/88)

The following C code shows up a bug in MWC V3.0.6 when using the
 -VPEEP option.

typedef struct _list { int value; struct _list *next; } LIST;
	.....
	register LIST *p, *q;

	q = p;
	p = p->next;
	if(p)
		p = q;
---------
		  p is a5     q is a4

	No -VPEEP		-VPEEP

	movea.l	a5, a4		movea.l	a5, a4
	movea.l	2(a5), a5	movea.l	2(a5), a5
	move.l	a5, -4(a6)	move.l	a5, -4(a6) <--This line not eliminated
	move.l	-4(a6), d0	move.l	a4, d0 <---SHOULD BE move.l a5,d0
	beq.s	L1		beq.s	L1
	movea.l	a4, a5		movea.l	a4, a5
L1:			    L1:
----------
	the sequence
		move.l a5, -4(a6)
		move.l -4(a6),d0
	should be peephole optimized to
		move.l a5,d0

In the cases when correct code is generated, it still does not remove
the first extraneous move.l a5,-4(a6) instruction.

The upgrade is defintly worth it. Csd is really worth it. BTW GULAM
users may have noticed that Csd looks at the PATH environment variable.
If your PATH does not have `.' in it, Csd does not find the executable
program (if it is in the current directory), and exits with error
code -33 (file not found). If PATH has `.' in it, CSD works great.