🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: net.micro.atari16
1 messages
1 total messages Started by Jan Gray Fri, 11 Apr 1986 22:57
Alcyon C compiler bugs
#380
Author: Jan Gray
Date: Fri, 11 Apr 1986 22:57
35 lines
1266 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads