[net.micro.atari16] Alcyon C compiler bugs

jan@looking.UUCP (Jan Gray) (04/12/86)

Hello, I ran across a nasty C compiler bug the other day:

The C source:
	struct foo {
		...
		unsigned array[1];	/* 8 bytes from start of struct */
	};

	func()
	{
		register struct foo	*baz;
		register unsigned	index;

		... = baz->array[index];
	}

generated:
	...
	<move baz into a0>
	<move index into d0>
	swap	d0
	clr	d0
	swap	d0
	clr	d0		<- no matter what index was, it's now 0!
	mov	8(a0,d0),d0
	...

So beware using register unsigned's as array indices.

Surely you other developers out there have compiled a list of bugs to
avoid...could you please post them to the net to save everyone from hardship?

Forced to read the .s output files,

Jan Gray	Looking Glass Software, Waterloo, Ont.	    (519) 884-7473