[comp.sys.amiga] Bug in Manx-Aztec 3.4b

kkaempf@rmi.UUCP (Klaus Kaempf) (03/09/88)

When compiling the Litte-Smalltalk program (from comp.sources.misc)
with Manx Aztec 3.4b, I discovered this (nasty) bug:

The Program:

#define        Bug(x) ( ((var=x) < 0) ? 1 : 2 )
main()
{
int var;
       var = Bug(6);
}

The compiler (assembler!) output:

Aztec C68K 3.4b  6-16-87  (C) 1982-1987 by Manx Software Systems, Inc.
Aztec 68000 Assembler 3.4b  6-1-87
       tst.w   #6
		 ^
ram:ctmpA42.760: 7: ***ERROR - Opcode operands did not match.
src=0 dst=502a404  <- this is always very informative :-)
1 errors

The Assembler-Source (shortened):

;#define       Bug(x) ( ((var=x) < 0) ? 1 : 2 )
;int var;
;      var = Bug(6);
       move.w  #6,-2(a5)
       tst.w   #6              <- this should better be tst.w -2(a5) !!
       bge     .4
       move.l  #1,d0
       bra     .5
.4
       move.l  #2,d0
.5
       move.w  d0,-2(a5)

If you omit the assignement var=x, the compiler interpretes the statement
directly and no error occurs.

I don't have 3.6a yet, so I don't know if this bug is still present in
the new compiler release.

Klaus