Article View: net.micro.atari16
Article #380Alcyon C compiler bugs
From: Jan Gray
Date: Fri, 11 Apr 1986 22:57
Date: Fri, 11 Apr 1986 22:57
35 lines
1266 bytes
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
Technical Details
Message-ID:
<521@looking.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!looking!janShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site looking.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!looking!jan From: jan@looking.UUCP (Jan Gray) Newsgroups: net.micro.atari16 Subject: Alcyon C compiler bugs Message-ID: <521@looking.UUCP> Date: Fri, 11-Apr-86 17:57:19 EST Article-I.D.: looking.521 Posted: Fri Apr 11 17:57:19 1986 Date-Received: Sat, 12-Apr-86 02:25:12 EST Distribution: net Organization: Looking Glass Software Ltd. Waterloo, Ontario Lines: 35