🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.atari
Article #1844

DRI C Assembler Bug

#1844
From: Computer Sci Club
Date: Wed, 18 Dec 1985 06:06
26 lines
1861 bytes
The programmers here at Unit 36 Research have discovered a cute little bug in
the DRI C compiler/assembler (for this is probably best considered an assembler
bug).  If one writes the code

	a = array[i = 0];

where "i" is an int, the compiler will set up the zero value in a register to
perform the array access.  In order to do this it writes a "clr a0".  The
assembler turns this into a "suba.w a0,a0" instruction which will not actually
clear the address register.  This instruction sign extends the lower word of
the address register and then subtracts that value (using 32 bit arithmetic)
from the original value.  This leaves garbage in the upper 16 bits of the
address register.  If the compiler then uses that value as a longword:
kaboom!  It really needs to generate the long version of the instruction.
Moving the index initialization out of the subscript cures the problem.  We
discovered this while writing a memory test program for the wonderful, sexy
new .5 megabytes we have installed in the ST.

Tracy Tims
Brian Stecher

PS.	Why have none of the damn microcomputer hackers discovered the value
	of good programming style?  I say we shoot anyone who can't write
	consistent, well structured, visually coherent code.  Or just have
	some licensing scheme to prevent tyros from writing and distributing
	offensive code 8-).  Gack, spew 8-(.
Technical Details
Message-ID: <550@watmath.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!watmath!csc

Show 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 watmath.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!watmath!csc
From: csc@watmath.UUCP (Computer Sci Club)
Newsgroups: net.micro.atari
Subject: DRI C Assembler Bug
Message-ID: <550@watmath.UUCP>
Date: Wed, 18-Dec-85 01:06:19 EST
Article-I.D.: watmath.550
Posted: Wed Dec 18 01:06:19 1985
Date-Received: Sat, 28-Dec-85 09:37:45 EST
Organization: U of Waterloo, Ontario
Lines: 26